Feature Request: LINQ syntactic sugar delegates (ex: orderby delegate ) #2402
Replies: 2 comments
-
I agree that composability of public static readonly Expression<Func<Category, object>> DescriptionThenGroup =
cat => new { cat.Description, cat.Group };
var categories =
from cat in db.Categories.AsExpandable()
where cat.Description == "<cat>"
orderby DescriptionThenGroup.Invoke(cat)
select cat; public static readonly Expression<Func<Employee, int, bool>> InCompany =
(e, companyId) => e.CompanyId == companyId;
var employees =
from e in db.Employees.AsExpandable()
where InCompany.Invoke(e, currentCompany)
select e; I feel like this approach is more versatile than what you propose. Though I wouldn't mind if LinqKit became better integrated with the framework or language. |
Beta Was this translation helpful? Give feedback.
-
Regarding: "I feel like this approach is more versatile than what you propose. Though I wouldn't mind if LinqKit became better integrated with the framework or language." I don't want to be loud but the code you presented lacks expressiveness. I have no idea what the code is trying to do anymore. It is confusing and looks like some class library code rather than a query for some data. A quick peek at LinqKit proves to be more of the same and I would much rather use LINQ joins than some of the proposed solutions given at the website link. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When I write my queries I prefer to write most of my queries using LINQ query syntax so it would be nice to be able to create delegates that could be used delegates passed to the syntax.
Please and thank you!
Beta Was this translation helpful? Give feedback.
All reactions