Reputation: 1830
We want to use ODataV4 on WebAPI 2.2 for our new projects but there is one no-go: the url design. We have to delivery json data and binary data (images) through our api.
Is there any possibility to avoid the namespace look of custom functions on OData routes?
/odata/Customers/GetByName('Name')
instead of /odata/Customers/CustomerService.GetByName('Name')
And how should a response with binary data (jpeg images) be implemented with OData controllers? A very ugly way would be to host OdataControllers and ApiControllers in one Project and use different url areas.
/odata/Customers(1) -> OdataControllers
/api/Customers/1/ProfileImage -> ApiController
Upvotes: 1
Views: 3073
Reputation: 706
Thank you, QianLi! You really helped!
HttpConfiguration config = …
config.EnableCaseInsensitive(caseInsensitive: true);
config.EnableUnqualifiedNameCall(unqualifiedNameCall: true);
config.EnableEnumPrefixFree(enumPrefixFree: true);
config.MapODataServiceRoute("odata", "odata", edmModel);
Upvotes: 0
Reputation: 1098
For your first question, please refer to http://odata.github.io/WebApi/#06-01-custom-url-parsing.
Upvotes: 4