Skip to content

umutozel/DynamicQueryable

Repository files navigation

DynamicQueryable

Construct Linq queries using strings.

Build status Coverage Status NuGet Badge GitHub issues GitHub license

GitHub stars GitHub forks

Play with jupyter notebook readme on:

Binder

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.

drawing Thanks to JetBrains for providing me with free licenses to their great tools.