What is the best approach to load/filter/order a Kendo grid with the following classes:
Domain:
public class Car
{
public virtual in
I came across this same issue and after lots of research I resolved it permanently by using AutoMapper.QueryableExtensions library. It has an extension method that will project your entity query to your model and after that you can apply ToDataSourceResult extension method on your projected model.
public ActionResult GetData([DataSourceRequest]DataSourceRequest request)
{
IQueryable entity = getCars().ProjectTo();
var response = entity.ToDataSourceResult(request);
return Json(response,JsonRequestBehavior.AllowGet);
}
Remember to configure Automapper using CreateMap.
Note: Here getCars will return IQueryable result car.