我想在任何mvc路由之前註冊一個服務路由。在mvc應用程序中註冊ServiceRoute?
有沒有像product/296eb068-2a1a-439a-b608-6dc0da49cb36
var factory = new DataServiceHostFactory();
var serviceRoute = new ServiceRoute("product/{*guid only}", factory,
typeof(ProductService));
serviceRoute.Defaults = new RouteValueDictionary { { "serviceType", "odata" }};
serviceRoute.Constraints = new RouteValueDictionary { { "serviceType", "odata"}};
routes.Add("myproduct", serviceRoute);
我知道{*guid only}
工作不註冊它的方式。有沒有辦法讓它成爲一個正則表達式約束?