Mapping large data models through OData and WebAPI

I have an EF model with approximately 200 tables, of which 75 I would like to open via REST in an MVC application. I started by adding a WCF data service (WCF-DS), pointing it to the EF and bam context, I had the whole database mapped to a REST URI with full OData syntax support in about 2 minutes.

Next, I tried to create the same REST URI space using the WebAPI. When I tried to add the WebAPI OData controller, the first thing he asked for was a model class, and when I finished creating the controller (and copying all the necessary ODataConventionModelBuilder code to WebApiConfig), I had only one REST endpoint! Now I see that WebAPI is not well suited to expose all EF models with a lot of brute force.

So my questions are:

  • Did I skip the way to map a bunch of WebAPI endpoints to an EF model in one fell swoop?

    (Maybe T4 templates that build all the WebAPI code when creating my EF model?)

  • Are there any good reasons to consider WebAPI vs WCF-DS for publishing large URI domains?

    (Some say that the benefits of WebAPI should have fine-grained control over every MVC / HTTP request, but that seems counterproductive if the goal is to meet the OData specification. I'm not sure I want to have 75 controllers and 1000 lines of code that will seduce of my fellow developers so that they change one behavior of the entity, which will lead to a different behavior from other objects.)

    (For cross-cutting issues such as security, caching, or performance management, WCF-DS seems to have sufficient configuration ability with Interceptors and the DataServiceConfiguration class. Are there any WebAPI features that would be better here?)

Thanks.

: , : http://msdn.microsoft.com/en-us/magazine/dn201742.aspx

+4
2

EF WCF DS, -API. WCF DS -API , , , EF WCF DS , OData. : WCF, Linq Entity Framework, , OData ( , WCF DS ).

: , 80 + 1000 . CRUD ( OData ). , OData - , .

+1

, Web API + OData , , OData , Web API API , - API.

, , , , , ( HTTP API). WCF-DS , EF-, 90% ( ).

, , ( ), , , . : Web API ( WCF-DS), WCF-DS, - -RESTful OData ( -).

Web API OData - , , WCF-DS. , , -API ASP.NET MVC, , . , , ( ). , , , : - .

: WCF-DS .

+1

All Articles