30% OFF - 10th Anniversary discount on Entity Framework Extensions until December 15 with code: ZZZANNIVERSARY10
Entity Framework Dynamic LINQ Discover How to Execute Dynamically
Definition
System.Linq.Dynamic allows you to express LINQ queries using extension methods that take string arguments instead of type-safe language operators.
Dynamic Expression API
The Dynamic Expression API is brought into scope by using (importing) the System.Linq.Dynamic namespace. Below is an example of applying the Dynamic Expression API to a LINQ to SQL data source.
var query = db.Customers. Where("City = @0 and Orders.Count >= @1", "London", 10). OrderBy("CompanyName"). Select("new(CompanyName as Name, Phone)");
Note that expressions in the query are strings that could have been dynamically constructed at run-time.
Requirements
Entity Framework Version
- All versions are supported.
ZZZ Projects