All Projects → linmasaki → Kendo.DynamicLinqCore

linmasaki / Kendo.DynamicLinqCore

Licence: MIT license
KendoNET.DynamicLinq implements server paging, filtering, sorting, grouping, and aggregating to Kendo UI via Dynamic Linq for .Net Core App(1.x ~ 3.x).

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Kendo.DynamicLinqCore

System.linq.dynamic.core
The .NET Standard / .NET Core version from the System Linq Dynamic functionality.
Stars: ✭ 864 (+2300%)
Mutual labels:  linq, dynamic, netstandard
Opentouryo
”Open棟梁”は、長年の.NETアプリケーション開発実績にて蓄積したノウハウに基づき開発した.NET用アプリケーション フレームワークです。 (”OpenTouryo” , is an application framework for .NET which was developed using the accumulated know-how with a long track record in .NET application development.)
Stars: ✭ 233 (+547.22%)
Mutual labels:  netcore, netstandard
Swan
Swan stands for Stuff We All Need. Unosquare's collection of C# extension methods and classes.
Stars: ✭ 202 (+461.11%)
Mutual labels:  netcore, netstandard
DynamicQueryable
λ Construct Linq queries using strings.
Stars: ✭ 46 (+27.78%)
Mutual labels:  linq, dynamic
Ffmediatoolkit
FFMediaToolkit is a cross-platform video decoder/encoder library for .NET that uses FFmpeg native libraries. It supports video frames extraction, reading stream metadata and creating videos from bitmaps in any format supported by FFmpeg.
Stars: ✭ 156 (+333.33%)
Mutual labels:  netcore, netstandard
Revo
Event Sourcing, CQRS and DDD framework for C#/.NET Core.
Stars: ✭ 162 (+350%)
Mutual labels:  netcore, netstandard
Platform Compat
Roslyn analyzer that finds usages of APIs that will throw PlatformNotSupportedException on certain platforms.
Stars: ✭ 250 (+594.44%)
Mutual labels:  netcore, netstandard
Zipstorer
A Pure C# Class to Store Files in Zip
Stars: ✭ 139 (+286.11%)
Mutual labels:  netcore, netstandard
dotnet-arangodb
.NET Driver for ArangoDB
Stars: ✭ 52 (+44.44%)
Mutual labels:  linq, netcore
ormdb
ORM tool for .Net / .Net.Core
Stars: ✭ 14 (-61.11%)
Mutual labels:  linq, netcore
Megaapiclient
MegaApiClient is a C# .Net library to access http://mega.co.nz / http://mega.nz cloud storage and file hosting service.
Stars: ✭ 151 (+319.44%)
Mutual labels:  netcore, netstandard
Autofac.Configuration
Configuration support for Autofac IoC
Stars: ✭ 35 (-2.78%)
Mutual labels:  netcore, netstandard
Fluentdispatch
🌊 .NET Standard 2.1 framework which makes easy to scaffold distributed systems and dispatch incoming load into units of work in a deterministic way.
Stars: ✭ 152 (+322.22%)
Mutual labels:  netcore, netstandard
Oxyplot
A cross-platform plotting library for .NET
Stars: ✭ 2,466 (+6750%)
Mutual labels:  netcore, netstandard
Activelogin.authentication
Support Swedish BankID (svenskt BankID) authentication in .NET.
Stars: ✭ 141 (+291.67%)
Mutual labels:  netcore, netstandard
Standard.licensing
Easy-to-use licensing library for .NET Framework, Mono, .NET Core, and Xamarin products
Stars: ✭ 239 (+563.89%)
Mutual labels:  netcore, netstandard
Oss.core
.net core下的领域开源电商网站,类库使用的标准库项目,集成微信和支付宝。 暂时还在开发阶段
Stars: ✭ 128 (+255.56%)
Mutual labels:  netcore, netstandard
Azos
A to Z Sky Operating System / Microservice Chassis Framework
Stars: ✭ 137 (+280.56%)
Mutual labels:  netcore, netstandard
EFSqlTranslator
A standalone linq to sql translator that can be used with EF and Dapper.
Stars: ✭ 51 (+41.67%)
Mutual labels:  linq, netcore
SharpAudio
Audio playback/capturing engine for C#
Stars: ✭ 139 (+286.11%)
Mutual labels:  netcore, netstandard

KendoNET.DynamicLinq

Version Downloads .NET Standard

Description

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

Prerequisites

.Net Core 1 ~ 2

  • None

.Net Core 3

  • You must add custom ObjectToInferredTypesConverter to your JsonSerializerOptions since System.Text.Json didn't deserialize inferred type to object properties now, see the sample code and reference.

Usage

  1. Add the KendoNET.DynamicLinq 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: "Groups",
    errors: "Errors"
}
  1. The completed code like below.
..... Other kendo grid code .....

dataSource: {
    schema:
    {
        data: "Data",
        total: "Total",
        aggregates: "Aggregates",
        groups: "Groups",
        errors: "Errors",
        ...
    },
    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);
        }
    },
    error: function(e) {
        console.log(e.errors); // Your error information
        e.sender.cancelChanges();
    },
    pageSize: 20,
    serverPaging: true,
    serverFiltering: true,
    serverSorting: true,
    ...
}

..... Other kendo grid code .....
  1. Import the KendoNET.DynamicLinq namespace.
  2. Use the ToDataSourceResult extension method to apply paging, sorting, filtering, grouping and aggregating.
using KendoNET.DynamicLinq

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

or from Kendo UI request

using KendoNET.DynamicLinq

[HttpPost]
public IActionResult Products([FromBody] DataSourceRequest requestModel)
{
    using (var northwind = new Northwind())
    {
        return northwind.Products
               .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(requestModel.Take, requestModel.Skip, requestModel.Sort, requestModel.Filter, requestModel.Aggregate, requestModel.Group);
    }
}

Known Issues

When server-side filterable options are enabled and apply a query with filter condition that contains DateTime type column, then EntityFramework Core would throw an 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 the 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");

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

How To Build NuGet Package

  1. Open command line console
  2. Switch to project root directory(src\KendoNET.DynamicLinq).
  3. Run "dotnet restore"
  4. Run "dotnet pack --configuration Release"
  5. Add <repository type="git" url="https://github.com/linmasaki/KendoNET.DynamicLinq.git" /> to package metadata of nupkg to show repository URL at Nuget

Note

KendoNET.DynamicLinq is a reference to Ali Sarkis's Kendo.DynamicLinq.

Kendo UI Documentation

The following links are Kendo UI online docs(related to this package) and you can refer to.

More Kendo UI configuration can refer to here

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].