For background, I am using MongoDB and Rob Conery's linq driver. The code I am attempting is thus:
using (var session = new Session<ContentItem>())
{
var contentCollection = session.QueryCollection.Where(x => x.CreatedOn < DateTime.Now).OrderByDescending(y => y.CreatedOn).ToList();
ViewData.Model = contentCollection;
}
this wi...
Let's say I have a dataset in an ASP.NET website (.NET 3.5) with 5 tables, each has roughly 30,000 rows and an average of 12 columns. I want to insert all of the data from the dataset into 5 very-similar-but-not-quite-identical tables in SQL Server 2008. I also want to use LINQ (personal preference - trying to learn something new).
Is...
I'm using C# 3.5 and EntityFramework. I have a list of items in the database that contain interest rates. Unfortunately this list only contains the Effective Start Date. I need to query this list for all items within a range.
However, I can't see a way to do this without querying the database twice. (Although I'm wondering if delay...
I'm writing the following code to convert SQL to LINQ and then to XML:
SqlConnection thisConnection = new SqlConnection(@"Data Source=3BDALLAH-PC;Initial Catalog=XMLC;Integrated Security=True;Pooling=False;");
thisConnection.Open();
XElement eventsGive =
new XElement("data",
from c in ??????
select new XElement("ev...
My current project is to take information from an OleDbDatabase and .CSV files and place it all into a larger OleDbDatabase.
I have currently read in all the information I need from both .CSV files, and the OleDbDatabase into DataTables.... Where it is getting hairy is writing all of the information back to another OleDbDatabase.
Right...
Hi All,
I am looking for linq query to see if there exists a similar object
I have an object graph as follows
Cart myCart = new Cart
{
List<CartProduct> myCartProduct = new List<CartProduct>
{
CartProduct cartProduct1 = new CartProduct
{
List<CartProductAttribute> a = new List<CartProductAttribute>
...
Say I have a structure like:
class SomeObject
Public Name as String
Public Created as Date
...
end class
I have a List(of SomeObject), which has multiple entries for each name with different times. I'd like to select the newest (largest Created value) object for each Name.
Given:
Name Created
A 2010-04-16 *
A ...
Hi,
I have a table in SQL database:
ID Data Value
1 1 0.1
1 2 0.4
2 10 0.3
2 11 0.2
3 10 0.5
3 11 0.6
For each unique value in Data, I want to filter out the row with the largest ID. For example: In the table above, I want to filter out the third and fourth row because the fifth and sixth rows...
hi there
i design a multilayer we appliction andusing LINQ a my data provider
i need to user my own Entites instead o LINQ etities. so i created Entities Project and create my entities in it.
when i get data from contex and cast them to my entities , everything is ok.
but when i want to cast on of my entities to linq entity , an excepti...
Background
I recently read that .NET 4's System.String class has a new overload of the Join method. This new overload takes a separator, and an IEnumerable<T> which allows arbitrary collections to be joined into a single string without the need to convert to an intermediate string array.
Cool! That means I can now do this:
var evenNum...
I've always pronounce it like "link", but I also heard people pronounce it "Lin-Q".
I am really curious whcih one is correct.
...
Hi all, in my goal to adopt better coding practices I have a few questions in general about automatic handling of code. I have heard different answers both from online and talking with other developers/programmers at my work. I am not sure if I should have split them into 3 questions, but they all seem sort of related:
1) How does .NET ...
I have a
class A {
public int X;
public double Y;
public string Z;
// and more fields/properties ...
};
and a List<A> data and can build a linq query like e.g.
var q = from a in data where a.X > 20 select new {a.Y, a.Z};
Then dataGridView1.DataSource = q.ToList(); displays the selection in my DataGridView.
Now the que...
I have an XML file like this:
<SiteConfig>
<Sites>
<Site Identifier="a" />
<Site Identifier="b" />
<Site Identifier="c" />
</Sites>
</SiteConfig>
The file is user-editable, so I want to provide reasonable error message in case I can't properly parse it. I could probably write a .xsd for it, but that seems kind of overk...
I'm not sure about clarity of the STAR word.
I'm implementing a search method using linq-to-object in c#.
And I want to do a search with * (star) operator like most of search apps or web can do.
e.g.
If I typed "p*", results should be everything starting with "p".
And it should work for prefix star, suffix star or star in the middle.
...
Okay I do not even know where to begin when it comes to this I am continuing from this question: http://stackoverflow.com/questions/2664029/linq-to-sql-statement-issue
Where I searched multiple columns in a table and returned my values in a datagrid,
Ive done basic formatting on the grid but am unable to decipher how I would go about
ge...
As an example, why do most LINQ operators accept Expression<Func<TSource>> and it's equivalent Func<TSource>
What's the benefit/reason for using the generic Expression class instead of straight up lamda syntax?
...
I have this problem where after a field (say Field3 in table MyTable) is updated on the database, MyTable.Field3 (in C#) is still returning the old value.
I suspect there is some caching...?
How do I force it to:
Read the value from the database?
OR
Update the value in the MyTable class?
Or is there anything I miss? I am new to LINQ
...
what is means of serailzation mode in LINQ to SQL?
what architecture does LINQ to SQL uses internally (connected or disconnected architecture)?
...
I'm converting from C# this LINQ expression. However, it does not seem to work.
C#
return (from w in fishSticks
group w by w.FishQty into g
orderby g.Key descending
select g).First().First();
VB
Return (From w In fishSticks
Group w By w.FishQty Into g()
Order By g.Key Descending
Se...