Registering the OData Service

When you create any Web API service, Visual Studio 2015 generates a file called WebApiConfig.vb, which is located in the App_Start folder. By default, the code in this file defines a template for routing HTTP requests to web pages in the application. This works fine in a Web API normal service, but it must be changed when working with an OData service. For this reason, replace the default code with the following:

Imports System.Web.HttpImports System.Web.OData.BuilderImports System.Web.OData.ExtensionsPublic Module WebApiConfig    Public Sub Register(ByVal config As HttpConfiguration)        Dim builder As New ODataConventionModelBuilder()        builder.EntitySet(Of Customer)("Customers") ...

Get Visual Basic 2015 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.