Following the general principle of route based versioning outlined here: http://aspnet.codeplex.com/SourceControl/latest#Samples/WebApi/ODataVersioningSample/ReadMe.txt
I have the following in my v1 namespace:
var model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute(
routeName: "OData",
routePrefix: null,
model: model);
config.Routes.MapODataRoute(
routeName: "Version1",
routePrefix: "v1",
model: model);
config.EnableQuerySupport();
I have the following in my v2 namespace:
var model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute(
routeName: "Version2",
routePrefix: "v2",
model: model);
config.EnableQuerySupport();
Now:
GET "/" == service document
GET "/v1/" == 404, and I expect the service document.
GET "/v2/" == 404, and I expect the service document.
GET "/v1/$metadata"== correct metadata.
GET "/v2/$metadata" == correct metadata.
I can't quite work out what else I'd need to do to get the service document to appear. It's not that important, it's just a quick way of verifying the the service is installed correctly.
I have the following in my v1 namespace:
var model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute(
routeName: "OData",
routePrefix: null,
model: model);
config.Routes.MapODataRoute(
routeName: "Version1",
routePrefix: "v1",
model: model);
config.EnableQuerySupport();
I have the following in my v2 namespace:
var model = modelBuilder.GetEdmModel();
config.Routes.MapODataRoute(
routeName: "Version2",
routePrefix: "v2",
model: model);
config.EnableQuerySupport();
Now:
GET "/" == service document
GET "/v1/" == 404, and I expect the service document.
GET "/v2/" == 404, and I expect the service document.
GET "/v1/$metadata"== correct metadata.
GET "/v2/$metadata" == correct metadata.
I can't quite work out what else I'd need to do to get the service document to appear. It's not that important, it's just a quick way of verifying the the service is installed correctly.