An open API service indexing awesome lists of open source software.

https://github.com/linmasaki/kendo.dynamiclinqcore2

Kendo.DynamicLinq for .Net Core 2.0
https://github.com/linmasaki/kendo.dynamiclinqcore2

kendo kendo-ui linq netcore2 netcore20

Last synced: over 1 year ago
JSON representation

Kendo.DynamicLinq for .Net Core 2.0

Awesome Lists containing this project

README

          

# Kendo.DynamicLinqCore2.0
[![Version](https://img.shields.io/nuget/vpre/Kendo.DynamicLinqCore2.svg)](https://www.nuget.org/packages/Kendo.DynamicLinqCore2)

# Note
Kendo.DynamicLinqCore2 is referred to Kendo.DynamicLinq by [kendo-labs](https://github.com/kendo-labs/dlinq-helpers).
Related notes can refer it.

## Description
Kendo.DynamicLinqCore2 implements server paging, filtering, sorting and aggregating via Dynamic Linq for .Net Core2.0.

## Build NuGet Package
1. Open command line console
2. Switch to project root directory.(src\Kendo.DynamicLinqCore2)
3. Run "dotnet restore"
4. Run "dotnet pack --configuration release"

## Usage
1. Add the Kendo.DynamicLinqCore2 NuGet package to your project.
2. Configure your Kendo DataSource to send its options as JSON.

parameterMap: function(options, type) {
return JSON.stringify(options);
}
3. Configure the `schema` of the DataSource.

schema: {
data: "Data",
total: "Total",
aggregates: "Aggregates",
groups: "Group"
}
4. Import the Kendo.DynamicLinqCore2 namespace.
5. Use the `ToDataSourceResult` extension method to apply paging, sorting and filtering.

[WebMethod]
public static DataSourceResult Products(int take, int skip, IEnumerable sort, Filter filter, IEnumerable aggregates, IEnumerable 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);
}
}

## Other Examples
This example has full demo with .Net Core2.0 by [Vahid Nasiri](https://github.com/VahidN).

- [KendoUI.Core.Samples](https://github.com/VahidN/KendoUI.Core.Samples)