c# - Filtering on Linq that contains Custom Type using ODataQueryOptions -
while implementing kendo grid in mvc perform server side operations, find myself in tricky situation, i.e., have filter, sort, paged data using linq. , information got in odataqueryoptions type.
(not sure if necessary mention or not, sake of completeness, perform query operations through unitofwork pattern)
so operation perform query copied below:
public static list<t> gett(this irepositoryasync<t> repository, odataqueryoptions<t> options) { var query = repository.query().tracking(false).include(x => x.t2) .select(s => new { p1 = s.p1, p2 = s.p2, p3 = s.t2.p1 + "," + s.t2.p2 }) .select(s => new t1 { p1 = s.p1, p2 = s.p2, p3 = s.p3 }); if (options.skip != null) query = query.skip(options.skip.value); if (options.top != null) query = query.take(options.top.value); return query.tolist(); }
now, want know if there option apply remaining odata options linq query (as can see $skip , $top applied, how can apply orderbyqueryoption , filterqueryoption).
in orderbyqueryoption there property orderbynodes
can use construct query, in filterqueryoption, it's hard translate filterclause, need filterbinder it's not public in 5.9.1, it's public in 6.0.0.
Comments
Post a Comment