I'm using System.Linq.Dynamic.Core
and EntityFramework
library to generate a query like this:
var q = context.Items.Select("new(SomeProperty)")
The q
is of type IQueryable
at the moment. I can successfully apply OrderBy
, Take
, Skip
and then execute the query.
But if I try to use the extension method from Kendo, things go south:
var results = q.ToDataSourceResult(new DataSourceRequest())
I get an Exception:
NotSupportedException
Unknown LINQ expression of type 'Dynamic'.
I know that the ToDataSourceResult
method adds the OrderBy
, Take
and Skip
to the IQueryable
to do the paging so that's the most likely source of the problem (it does create a dynamic expression if the object is object
or IDynamicMetaObjectProvider
)
Any idea how to workaround this?
You could also try this package https://github.com/StefH/KendoGridBinderEx which is created for Kendo Grid queries and uses System.Linq.Dynamic.Core