-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathWebApiConfig.vb
More file actions
29 lines (23 loc) · 883 Bytes
/
WebApiConfig.vb
File metadata and controls
29 lines (23 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web.Http
Imports DxSample.Service.Models
Imports System.Web.OData.Builder
Imports System.Web.OData.Extensions
Namespace DxSample.Service
Public NotInheritable Class WebApiConfig
Private Sub New()
End Sub
Public Shared Sub Register(ByVal config As HttpConfiguration)
' Web API configuration and services
' Web API routes
config.MapHttpAttributeRoutes()
config.Routes.MapHttpRoute(name:= "DefaultApi", routeTemplate:= "api/{controller}/{id}", defaults:= New With {Key .id = RouteParameter.Optional})
Dim builder As ODataModelBuilder = New ODataConventionModelBuilder()
builder.EntitySet(Of Customer)("Customers")
builder.EntitySet(Of Order)("Orders")
config.MapODataServiceRoute("ODataRoute", Nothing, builder.GetEdmModel())
End Sub
End Class
End Namespace