OData without IQueryable

I am thinking of using OData for my web service (based on the Web API). Unfortunately, my data source is NOT IQueryable. Instead of implementing my own IQueryable, I pretty much followed this blog post .

What I do not understand is how to get to my object data model (EDM)? Should I model EDM, for example, in Designer? Or is it just for EF, and instead I can use "simple" classes and set relationship attributes? I do not want to disclose my internal data structures, so my EDM is more like a DTO ...

As an example, I saw what I should get from EntitySetController to get an OData compatible HTTP response. I believe that I cannot use EntitySetController as I do not support IQueryable. What should I do to get the right answer?

+5
source share
1 answer

You can create an EDM model yourself. You can use the class ODataConventionModelBuilderto create your EDM model. This tutorial contains sample code. Also, check out OData samples from here , especially ODataServiceSample and ODataCompositeKeySample. They must start you.

Alternatively, if you haven't IQueryable, you can get ODataControllerinstead EntitySetController.

+4

All Articles