Kendo.DynamicLinqCore2 is referred to Kendo.DynamicLinq by kendo-labs. Related notes can refer it.
Kendo.DynamicLinqCore2 implements server paging, filtering, sorting and aggregating via Dynamic Linq for .Net Core2.0.
- Open command line console
- Switch to project root directory.(src\Kendo.DynamicLinqCore2)
- Run "dotnet restore"
- Run "dotnet pack --configuration release"
-
Add the Kendo.DynamicLinqCore2 NuGet package to your project.
-
Configure your Kendo DataSource to send its options as JSON.
parameterMap: function(options, type) { return JSON.stringify(options); }
-
Configure the
schema
of the DataSource.schema: { data: "Data", total: "Total", aggregates: "Aggregates", groups: "Group" }
-
Import the Kendo.DynamicLinqCore2 namespace.
-
Use the
ToDataSourceResult
extension method to apply paging, sorting and filtering.[WebMethod] public static DataSourceResult Products(int take, int skip, IEnumerable<Sort> sort, Filter filter, IEnumerable<Aggregator> aggregates, IEnumerable<Sort> group) { using (var northwind = new Northwind()) { return northwind.Products .OrderBy(p => p.ProductID) // EF requires ordering for paging .Select(p => new ProductViewModel // Use a view model to avoid serializing internal Entity Framework properties as JSON { ProductID = p.ProductID, ProductName = p.ProductName, UnitPrice = p.UnitPrice, UnitsInStock = p.UnitsInStock, Discontinued = p.Discontinued }) .ToDataSourceResult(take, skip, sort, filter, aggregates, group); } }
This example has full demo with .Net Core2.0 by Vahid Nasiri.