Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Kendo DataSourceRequest and DataSourceResult with .Net Core

I appreciate Kendo's DataSourceRequest and DataSourceResult. Unfortunately, it seems the only example code and (readily discoverable) supporting libraries are for the full CLR. For those of us using .Net Core, I have no idea where the proper documentation or libraries are found. Worse, I don't think the libraries for .Net Core are complete.

Can someone point me to .Net Core specific documentation and nuget package name(s)?

In particular I'd like to solve the filter de-serialization problem described here. That link explains that the DataSourceRequest filter will have parameter values properly de-serialized as long as I decorate my MVC actions with the [DataSourceRequest] attribute, as follows:

[HttpPost]
public JsonResult Get([DataSourceRequest] DataSourceRequest request)
{
    var employees = db.Employees.Where(e => e.IsActive);
    var results = employees.ToDataSourceResult(request);
    return Json(results);
}

Unfortunately, Kendo (or the open source community?) does not seem to have provided that [DataSourceRequest] attribute for .Net Core. I'd also like to the the parameterMap function I see so many articles discussing...but it also appears to be unavailable for .Net Core.

Possibly these capabilities are truly missing for .Net Core, or perhaps I'm not aware of the correct place to shop for the libs or Nugets I need.

I'm looking for guidance.

like image 571
Brent Arias Avatar asked Nov 18 '22 17:11

Brent Arias


1 Answers

I don't know how it was when you asked, but now a nuget is available on telerik nuget server : https://nuget.telerik.com/nuget

It needs credentials as explained on this page : Telerik Config for .Net core

  • Add a new package source to https://nuget.telerik.com/nuget
  • Select Telerik Source and add your credentials (telerik.com email and password) as prompted.

There is an example here that could be usefull : Kendo UI Angular with .Net core

Here a small part of the code:

using Microsoft.AspNetCore.Mvc;
using Kendo.Mvc.UI;
using Kendo.Mvc.Extensions;
using System.Collections;

namespace dotnet_angular.Controllers
{
   [Route("api/Products")]
   public class SampleController : Controller
   {
       [HttpGet]
       public JsonResult GetProducts([DataSourceRequest]DataSourceRequest request)
       {
           var result = Json(this.products.ToDataSourceResult(request));
           return result;
       }
...
like image 127
Azepic Avatar answered Dec 15 '22 09:12

Azepic