For the use case of a remote data source delivering json to a grid one would typically use a simple combination of an entity framework object using extension method ToDataSourceResult. For example:
ToDataSourceResult() takes care of inspecting the request and applying the supplied criteria for filtering, sorting, grouping, paging, etc... to create an EF query in the connected database.
What happens if the database object being queried does not have an EF model ?
The above pattern of coding can not be used.
The lack of an EF model could be by design oversite, or the object is dynamic in nature. A dynamically constructed pivot view can not be compile time modeled for EF. The following method shows how the DataSourceRequest filter data is used to construct a parameterized where clause for a query in SqlServer. Slight modifications may be needed for other target data bases:
is called from this method
Which is utilized by this read method that applies the data of the DataSourceRequest in the making of a 'manual' query
Enjoy and happy coding.