I am having some issues with the MVC Wrappers for Kendo UI. It seems that IEnumerable does not support any aggregate values other than count. The exception that I get is: No generic method 'Sum' on type 'System.Linq.Enumerable' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. I am using System.LInq.Dynamic but this issue occurs without using a Dynamic query.
I am not sure how to get around this issues nor am I sure if it is a flaw with Kendo.
Controller
public ActionResult Index() { return View(); }public ActionResult Read([DataSourceRequest] DataSourceRequest request) { return GetView(request); }private IEnumerable<dynamic> GetData() { var db = new NwEntities(); return db.Products.Select("new(ProductID,ProductName,UnitPrice)"); }private JsonResult GetView(DataSourceRequest request) { return Json(GetData().ToDataSourceResult(request)); }View
@model IEnumerable<dynamic>@( Html.Kendo().Grid(Model).Name("Grid") .DataSource(ds => ds.Ajax() .Model(m => { m.Id("ProductID"); m.Field("ProductName", typeof(string)); m.Field("UnitPrice", typeof(decimal)); }) .Aggregates(aggregate => aggregate.Add(a => "UnitPrice").Count().Sum()) .Read(r => r.Action("Read", "Home")) ) .Columns(columns => { columns.Bound("ProductID"); columns.Bound("ProductName"); columns.Bound("UnitPrice").Format("{0:c}"); }) .Groupable())I have spent a week trying to get this to work with no luck and this is a critical issue.