From the course: Advanced ASP.NET Web API 2.2

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Configuring the OData endpoint

Configuring the OData endpoint

From the course: Advanced ASP.NET Web API 2.2

Start my 1-month free trial

Configuring the OData endpoint

- [Instructor] Now that we have set up the environment, by installing the entity framework and all data libraries, let us configure the OData endpoint. And to configure it, we need to first create the ODataModelBuilder. Then next, we need to define the entity for which we want to use and at the end, we need to configure the MapODataServiceRoute. So, let's go to Visual Studio and see this in action. Since we are doing a configuration, we need to go to the configuration file which is on app start folder. The WebApiConfig.cs file. Now, you need to make sure you write this code after the web API routes. So, let's us write in here ODataConfiguration. So we say that the first thing is that we need to create the ODataModelBuilder. For that, we write in here ODataModelBuilder. Let us name this builder and this is equal to new ODataConventionModelBuilder. Let's import the necessary name spaces which is the ODataBuilder…

Contents