This blog is a knowledge base...where I clip cool tricks and urls

Dynamic Query Reflection within Linq

clipped from
As I suggested in my comment on the last blog post - read the docs and samples...and failing that ask a question on the LINQ forums:

Even Anders hangs out on that forum - so you will get help if you ask a question on it. ;-)

Daniel Moth has a good pointer to some LINQ samples you can use: One of these LINQ samples is called "DynamicQuery", and it provides a useful library that enables you to write dynamic LINQ expressions that enable you to accomplish what you are after above.

For example, you could write:

var query =
Where("City = @0 and Orders.Count >= @1", "London", 10).
Select("new(CompanyName as Name, Phone)");
 blog it

No comments: