I took a look at [Tutorial & Sample] Use Enumeration types in OData to see how I could filter data returned by OData using an enumeration. The data model I'm using has a long namespace, and it would be nice to be able to use something shorter, rather than
Organization.Office.Project.DomainObjects.Enumerations.MyEnumeration'MyValue'
it'd be nice to be able to just to do MyEnumeration'MyValue'
. How can I do this? I tried setting the Namespace
property of the ODataConventionModelBuilder
, but it had no effect.
Web API OData supports the enum prefix free. I think that's you're looking for.
With enum prefix free enabled, you can directly use the enum value, for example,
'MyValue'
Below is the sample codes how to enable the enum prefix free. http://odata.github.io/WebApi/#06-01-custom-url-parsing
Below's the corresponding end to end test cases provided by OData team:
Below is the more detail introduction about the Uri parser extension. http://blogs.msdn.com/b/odatateam/archive/2014/09/12/tutorial-amp-sample-odatauriparser-extension-support.aspx
Thanks