Deepak Rao
Deepak Rao

Reputation: 63

using webapi odata without using ODataConventionModelBuilder

I have written a apicontroller class that supports ODATA by using the EnableQuery attribute on the methods and returning the data asQueryable. It alls works fine for me. What use is the ODataConventionModelBuilder? Do I still need to use it?

Upvotes: 2

Views: 264

Answers (1)

Yi Ding - MSFT
Yi Ding - MSFT

Reputation: 3024

The using of ODataConventionModelBuilder enables

  1. The mapping from your POCO classes to the OData model including handling primitive types, complex types, entities types and relationships between them, actions, function, and so on.
  2. It also helps validate if you have a correct OData model.
  3. It helps set up the metadata document and service document.

If you really want to expose an OData service that conforms the OData protocol, you would need to do a lot yourselves without the ODataConventionModelBuilder. But if you don't care about things like conforming model conventions or exposing the service model to the service consumers, you may not use it.

Upvotes: 4

Related Questions