I see that Kendo has a Dynamic Linq library that handles the paging, sorting and filtering for you for MVC apps. I was reading about it here. The following example is given:
<
p
>using Kendo.DynamicLinq;
public class EmployeesController : Controller {
[HttpPost]
public ActionResult Get(int take, int skip, IEnumerable<
Kendo.DynamicLinq.Sort
> sort, Kendo.DynamicLinq.Filter filter) {
var employees = _context.Employees.OrderBy(e => e.Employee_ID)
.OrderBy(e => e.Employee_ID)
.Select(e => new Models.Employee {
EmployeeID = e.Employee_ID,
FirstName = e.First_Name,
LastName = e.Last_Name,
Title = e.Title,
BirthDate = e.Birth_Date
});
return Json(employees.ToDataSourceResult(take, skip, sort, filter));
}
}<
br
></
p
><
p
></
p
><
p
></
p
>
It seems to me that a problem with this approach is that there is no chance to do any mapping from the data entities which are returned from the database call to to a DTO entity. What I do in my app is execute a databaes call using EF and map the EF entity to an application entity. Is there a way I can still do this given the example above. In other words, I'd like the ToDataSourceResult function to create a Json document based on the mapped DTO entity and not the EF database entity.