Construct Linq queries using strings.
Play with jupyter notebook readme on:
Install-Package DynamicQueryable
dotnet add package DynamicQueryable
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();
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
DynamicQueryable is under the MIT License.
Thanks to JetBrains for providing me with free licenses to their great tools.