Linq.Extension 1.0.0.7

Linq Extension to provide Dynamic Where Condition and Dynamic Select, Dynamic Take If Positive Number, Pagination and Nesting Predicates with parenthesis. Use SearchInput class for Dynamic Where and PaginationInput for pagination (take, skip and sort).

Install-Package Linq.Extension -Version 1.0.0.7
dotnet add package Linq.Extension --version 1.0.0.7
<PackageReference Include="Linq.Extension" Version="1.0.0.7" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Linq.Extension --version 1.0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Linq.Extension, 1.0.0.7"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Linq.Extension as a Cake Addin
#addin nuget:?package=Linq.Extension&version=1.0.0.7

// Install Linq.Extension as a Cake Tool
#tool nuget:?package=Linq.Extension&version=1.0.0.7
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

/////////////////////////////////////// Pagination and Search Example //////////////////////////////////////////////////////////////////////
{ "pagination" : {"take": 100, "skip": 100, "sorts": [{"fieldName": "created", "direction": "desc"}, {"fieldName": "quantity", "direction": "asc"}]}, "search" : {"filters": [{ "logic": "or", "operation": "eq", "value": 3245, "fieldName": "orderId" }, { "logic": "and", "operation": "inlist", "value": "32,66,87,199", "fieldName": "customerId" }, { "logic": "and", "operation": "gte", "value": 600, "fieldName": "customerId" } ]}}

Above Json object is converted to conditionalArguments as IDictionary<string, object> conditionalArguments and passed to following query.
From above dictionary first entry will be like that
key = "pagination", value ={ "take": 100, "skip": 100, "sorts": [{"fieldName": "created", "direction": "desc"}, {"fieldName": "quantity", "direction": "asc"}]}
value will be an object containing Json object.

var res = this._context.Hobbies
.AsNoTracking()
.Where(LinqDynamicExtension.DynamicWherePredicate
<HobbyDataLayer.Models.Hobby>(conditionalArguments))
.Pagination(conditionalArguments)
.Select(LinqDynamicExtension.DynamicSelectGeneratorAnomouysType
<HobbyDataLayer.Models.Hobby>(selectionFields))
.ToList()
.ToNonAnonymousList(typeof(HobbyDataLayer.Models.Hobby));

var results = (IEnumerable<HobbyDataLayer.Models.Hobby>) res;

/////////////////////////////////////// Pagination and Search Example //////////////////////////////////////////////////////////////////////
{ "pagination" : {"take": 100, "skip": 100, "sorts": [{"fieldName": "created", "direction": "desc"}, {"fieldName": "quantity", "direction": "asc"}]}, "search" : {"filters": [{ "logic": "or", "operation": "eq", "value": 3245, "fieldName": "orderId" }, { "logic": "and", "operation": "inlist", "value": "32,66,87,199", "fieldName": "customerId" }, { "logic": "and", "operation": "gte", "value": 600, "fieldName": "customerId" } ]}}

Above Json object is converted to conditionalArguments as IDictionary<string, object> conditionalArguments and passed to following query.
From above dictionary first entry will be like that
key = "pagination", value ={ "take": 100, "skip": 100, "sorts": [{"fieldName": "created", "direction": "desc"}, {"fieldName": "quantity", "direction": "asc"}]}
value will be an object containing Json object.

var res = this._context.Hobbies
.AsNoTracking()
.Where(LinqDynamicExtension.DynamicWherePredicate
<HobbyDataLayer.Models.Hobby>(conditionalArguments))
.Pagination(conditionalArguments)
.Select(LinqDynamicExtension.DynamicSelectGeneratorAnomouysType
<HobbyDataLayer.Models.Hobby>(selectionFields))
.ToList()
.ToNonAnonymousList(typeof(HobbyDataLayer.Models.Hobby));

var results = (IEnumerable<HobbyDataLayer.Models.Hobby>) res;

Release Notes

Added Nesting Predicates with parenthesis for same field name. Grouped same field name expressions into one parenthesis and apply the logic of first filter of sequence of same field with other fields.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0.7 145 10/4/2020
1.0.0.5 333 7/30/2020
1.0.0.4 153 7/29/2020
1.0.0.3 189 7/29/2020
1.0.0.2 147 7/28/2020
1.0.0.1 146 7/28/2020
1.0.0 192 7/27/2020