I recently updated OData from (v5.9.1) to the latest stable version (v6.0.0) and in the former one I used to configure my environment like this:
//Allows calling the Url like {entityAction}/{id}
config.SetUrlConventions(ODataUrlConventions.KeyAsSegment);
//Allows urls to be case insensitive
config.EnableCaseInsensitive(true);
// Remove the necessity of having to specify the namespace of enums.
config.EnableEnumPrefixFree(true);
//This allows call a function without using the full namespace.
config.EnableUnqualifiedNameCall(true);
config.MapODataServiceRoute("odata", "api/rest",
edmModel, new DefaultODataBatchHandler(GlobalConfiguration.DefaultServer));
Now after the update, how can I achieve the same result as before? None of my routes e.g: 'localhost/odata/people/' are working it shows the following message:
The path template 'people/{parentId}/emails' on the action 'Get' in controller 'PersonEmails' is not a valid OData path template. The operation import overloads matching 'people' are invalid. This is most likely an error in the IEdmModel.
Any ideas? Thanks in advance.
I encountered the same issue. There is an internal class in System.Web.OData called UnqualifiedCallAndEnumPrefixFreeResolver. This in theory would handle both EnumPrefixFree and UnqualifiedNameCall, but as this is internal i had to write my own for now.
The usage would be as follows:
I also posted this on GitHub as an issue, but for now no answer from the team, this workarround is an alternative until we get something in standard.
Github link
Regards, Mihai