DynamicQueryable
DynamicQueryable copied to clipboard
λ Construct Linq queries using strings.
DynamicQueryable
Construct Linq queries using strings.
Play with jupyter notebook readme on:
Installation
Package Manager
Install-Package DynamicQueryable
.Net CLI
dotnet add package DynamicQueryable
Getting Started
Start with adding System.Linq.Dynamic namespace to usings.
// you can use inline values
query.Where("o => o.Id > 5").ToList();
// or you can pass ordered values, @0 will be replaced with first argument
query.Where("o => o.Id > @0", 5).ToList();
// or you can use named variables, AvgId will be replaced with value from given dictionary
query.Where("o => o.Id > AvgId", new Dictionary<string, object> { { "AvgId", AvgId } }).ToList();
Supported Methods
Aggregate, All, Any, Average, Concat, Contains, Count, DefaultIfEmpty, Distinct, Except, ElementAt, ElementAtOrDefault, First, FirstOrDefault, GroupBy, GroupJoin, Intersect, Join, Last, LastOrDefault, LongCount, Max, Min, OrderBy, OrderByDescending, Reverse, Select, SelectMany, SequenceEqual, Single, SingleOrDefault, Skip, SkipWhile, Sum, Take, TakeWhile, ThenBy, ThenByDescending, Union, Where, Zip
License
DynamicQueryable is under the MIT License.
Thanks to JetBrains for providing me with free licenses to their great tools.