I'm in an ODataController
and I have an ODataQueryOptions
(and all the rest of it).
I know that the source of the data is a table in SQL Server.
However, my EF model (that was used by the WEB API framework to route the HTTP request to my controller) is typeless, i.e., I don't have a POCO class.
Normally -- if I did have a POCO class -- the framework would magically write SQL from the OData query so that the paging, filtering, and sorting is done on the database and not in memory on the web server. You can use Database.Log
on the DbContext
to see the SQL that's generated from LINQ statements involving the POCO classses.
How do I get this to happen for me? I have the EF model, I have the OData request, but how do I combine them to query SQL Server?