I'm having a weird problem when I'm writing an OData function. This function takes a string parameter, and returns a collection of DTOs. This function works fine as long as the string parameter doesn't contain the character 'E'. I'm wondering if it is a bug in the UrlRoutingModule or something?
The method declaration is:
[EnableQuery]
[ODataRoute("GetMaintainingLogByIdNumber(IdNumber={IdNumber})")]
public IEnumerable<MaintainingLogDto> GetMaintainingLogByIdNumber([FromODataUri]string IdNumber)
And the code to register this function in Edm Model is:
modelBuilder
.Function("GetMaintainingLogByIdNumber")
.ReturnsCollectionFromEntitySet<MaintainingLogDto>("MaintainingLog")
.Parameter<string>("IdNumber");
If I call this function with
http://hostname/odata/GetMaintainingLogByIdNumber(IdNumber='0001100110124221929')
The function returns correct result. And this url, which includes an ’E' will cause a 404
http://hostname/odata/GetMaintainingLogByIdNumber(IdNumber='000110011E0124221929')
All other characters are working fine.
It is indeed a bug of the URL parser of our ODataLib implementation, a Github issue has been opened in our issue tracker: https://github.com/OData/odata.net/issues/3 and it is fixed in our internal code base. You should be able to see the fix in our next Nuget release and the corresponding fix code in our next Github source update.