-
as seen on Stack Overflow
- Search for 'Stack Overflow'
I need to write some dynamic queries for a project I'm working on. I'm finding out that a significant amount of time is being spent by my program on the Count and First methods, so I started to change to .Single, only to find out that there is no such method.
The code below was my first attempt…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
Hello,
We want to set up a directory of all the organizations working with us. They are incredibly diverse (government, embassy, private companies, and organizations depending on them ). So, I've resolved to create 2 tables. Table 1 will treat all the organizations equally, i.e. it'll collect all…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
If you do something like this in your Repository:
IQueryable<CarClass> GetCars(string condition, params object[] values) {
return db.Cars.Where(condition, values);
}
And you set the condition and values outside of the repository:
string condition = "CarMake == @Make";
object[] values…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
In Linq Dynamic Query, Scott Guthrie shows an example Linq query:
var query =
db.Customers.
Where("City == @0 and Orders.Count >= @1", "London", 10).
OrderBy("CompanyName").
Select("new( CompanyName as Name, Phone)");
Notice the projection new( CompanyName as Name, Phone). If…
>>> More
-
as seen on Stack Overflow
- Search for 'Stack Overflow'
In System.Linq.Dynamic, there are a few methods to form Select, Where and other Linq statements dynamically. But there is no for SelectMany.
The method for Select is as the following:
public static IQueryable Select(this IQueryable source, string selector, params object[] values)
{
…
>>> More