Kendo.DynamicLinqCore 2.0.2

Kendo.DynamicLinqCore implements server paging, filtering, sorting and aggregating to Kendo UI via Dynamic Linq for .Net Core App(1.x ~ 2.x).

Supported platforms:

- .NET Standard 1.6
- .NET Standard 2.0
- .NET Core 1.0 ~ .NET Core 1.1
- .NET Core 2.0 ~ .NET Core 2.2

There is a newer version of this package available.
See the version list below for details.
Install-Package Kendo.DynamicLinqCore -Version 2.0.2
dotnet add package Kendo.DynamicLinqCore --version 2.0.2
<PackageReference Include="Kendo.DynamicLinqCore" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Kendo.DynamicLinqCore --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Kendo.DynamicLinqCore, 2.0.2"
#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 Kendo.DynamicLinqCore as a Cake Addin
#addin nuget:?package=Kendo.DynamicLinqCore&version=2.0.2

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

Kendo.DynamicLinqCore implements server paging, filtering, sorting and aggregating to Kendo UI via Dynamic Linq for .Net Core App(1.x ~ 2.x).

Usage

  1. Add the Kendo.DynamicLinqCore NuGet package to your project.
  2. Configure your Kendo DataSource to send its options as JSON.
parameterMap: function(options, type) {
    return JSON.stringify(options);
}
  1. Configure the schema of the dataSource.
schema: {
    data: "Data",
    total: "Total",
    aggregates: "Aggregates",
    groups: "Group"
}
  1. The completed code like below.
..... Other kendo grid code .....

dataSource: {
    schema:
    {
        data: "Data",
        total: "Total",
        aggregates: "Aggregates",
        groups: "Group",
        ...
    },
    transport: {
        read: {
            url: 'your read url',
            dataType: 'json',
            contentType: 'application/json; charset=utf-8',
            type: 'POST'
        },
        create: {
            url: 'your create url',
            dataType: "json",
            contentType: 'application/json; charset=utf-8',
            type: 'POST'
        },
        parameterMap: function (data, operation) {
            return JSON.stringify(data);
        }
    },
    pageSize: 20,
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true,
    ...
}

..... Other kendo grid code .....
  1. Import the Kendo.DynamicLinqCore namespace.
  2. Use the ToDataSourceResult extension method to apply paging, sorting and filtering.
using Kendo.DynamicLinqCore

[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);
    }
}

Known Issues

When server side filterable options is enabled and apply a query with filter condition that contains datetime type column, then EntityFramework Core would throw a exception System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting date and/or time from character string. The error is caused by a known issue in some old EntityFramework Core versions. The workaround is adding datetime value to related column in DbContext. e.g.

public class MyContext : DbContext
{
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        ..........

        modelBuilder.Entity<Member>().Property(x => x.UpdateTime).HasColumnType("datetime");

        ..........
    }
}

Note

Kendo.DynamicLinqCore is referred to Kendo.DynamicLinq by kendo-labs. Related notes can refer it.

Examples

The following examples use Kendo.DynamicLinq(Not Kendo.DynamicLinqCore, but similar) and you can consult.

More Kendo UI Grid configuration can refer to here

Kendo.DynamicLinqCore implements server paging, filtering, sorting and aggregating to Kendo UI via Dynamic Linq for .Net Core App(1.x ~ 2.x).

Usage

  1. Add the Kendo.DynamicLinqCore NuGet package to your project.
  2. Configure your Kendo DataSource to send its options as JSON.
parameterMap: function(options, type) {
    return JSON.stringify(options);
}
  1. Configure the schema of the dataSource.
schema: {
    data: "Data",
    total: "Total",
    aggregates: "Aggregates",
    groups: "Group"
}
  1. The completed code like below.
..... Other kendo grid code .....

dataSource: {
    schema:
    {
        data: "Data",
        total: "Total",
        aggregates: "Aggregates",
        groups: "Group",
        ...
    },
    transport: {
        read: {
            url: 'your read url',
            dataType: 'json',
            contentType: 'application/json; charset=utf-8',
            type: 'POST'
        },
        create: {
            url: 'your create url',
            dataType: "json",
            contentType: 'application/json; charset=utf-8',
            type: 'POST'
        },
        parameterMap: function (data, operation) {
            return JSON.stringify(data);
        }
    },
    pageSize: 20,
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true,
    ...
}

..... Other kendo grid code .....
  1. Import the Kendo.DynamicLinqCore namespace.
  2. Use the ToDataSourceResult extension method to apply paging, sorting and filtering.
using Kendo.DynamicLinqCore

[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);
    }
}

Known Issues

When server side filterable options is enabled and apply a query with filter condition that contains datetime type column, then EntityFramework Core would throw a exception System.Data.SqlClient.SqlException (0x80131904): Conversion failed when converting date and/or time from character string. The error is caused by a known issue in some old EntityFramework Core versions. The workaround is adding datetime value to related column in DbContext. e.g.

public class MyContext : DbContext
{
    protected override void OnModelCreating(ModelBuilder modelBuilder)
    {
        ..........

        modelBuilder.Entity<Member>().Property(x => x.UpdateTime).HasColumnType("datetime");

        ..........
    }
}

Note

Kendo.DynamicLinqCore is referred to Kendo.DynamicLinq by kendo-labs. Related notes can refer it.

Examples

The following examples use Kendo.DynamicLinq(Not Kendo.DynamicLinqCore, but similar) and you can consult.

More Kendo UI Grid configuration can refer to here

Release Notes

1. Fix the problem that when query with conditions for a large amount of data will throw exception.
2. Fix when the filter condition is too much, the logic will be incorrect and the result will be unexpected.
3. Fix using aggregate count when the framework is .NET Core 1.0 will throw an exception.
4. Optimize performance and remove unnecessary properties.
5. When the filter condition has a datetime type value, the time is automatically changed to the server's local time.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Kendo.DynamicLinqCore:

Package Downloads
Kharazmi.AspNetCore.Core
Kharazmi.AspNetCore.Core is a Lightweight and Extensible Infrastructure for provides common scenarios' solutions for ASP.NET Core applications.
Kharazmi.AspNetCore.Localization.EFCore
ASP.NET Core provides services and middleware for localizing into different languages and cultures. You can create EntityFramework core concretes as your repository.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
3.1.1 6,266 11/5/2020
3.1.0 24,800 2/11/2020
2.2.2 14,241 9/17/2019
2.2.0 2,544 7/5/2019
2.1.0 12,075 5/16/2019
2.0.2 574 4/12/2019
2.0.0 4,613 9/10/2018
1.0.5 1,081 1/4/2018
1.0.4 675 11/29/2017
1.0.3 1,204 2/6/2017
1.0.2 674 1/13/2017
1.0.1 859 12/30/2016
Show less