Apart from auto mapping CLR Classes to EDM models, what are the advantages or use-cases for the ODataConventionModelBuilder
?
What specific set of pains does it make go away? With sample code if possible.
ODataConventionModelBuilder is used to automatically map CLR classes to an EDM model based on a set of.
OData service uses an abstract data model called Entity Data Model (EDM) to describe the exposed data in the service. OData client can issue a GET request to the root URL of the OData service with $metadata to get an XML representation of the service's data model. In Microsoft ASP.NET Web API 2.2 for OData v4.
OData defines parameters that can be used to modify an OData query. The client sends these parameters in the query string of the request URI. For example, to sort the results, a client uses the $orderby parameter: http://localhost/Products?$orderby=Name. The OData specification calls these parameters query options.
The Open Data Protocol (OData) is a data access protocol for the web. OData provides a uniform way to query and manipulate data sets through CRUD operations (create, read, update, and delete). ASP.NET Web API supports both v3 and v4 of the protocol.
ODataConventionModelBuilder is used for generating the Entity Data Model (EDM) for your OData service. The main purpose of EDM is used to define the type system, relationships and the actions that can be exposed by your OData service model.
If you are looking for a specific example, see this link - http://bitoftech.net/2014/04/16/create-read-only-odata-endpoint-using-asp-net-web-api/
In general OdataConventionModelBuilder is preferred over ODataModelBuilder since it infers the inheritance hierarchies, navigation properties and standard properties.
Also look at this link - http://blogs.msdn.com/b/alexj/archive/2012/11/02/odata-in-webapi-microsoft-asp-net-web-api-odata-0-2-0-alpha-release.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With