[英]Character 'E' in OData v4's function string parameter is causing 404 error
I'm having a weird problem when I'm writing an OData function. 我在编写OData函数时遇到一个奇怪的问题。 This function takes a string parameter, and returns a collection of DTOs.
此函数采用字符串参数,并返回DTO的集合。 This function works fine as long as the string parameter doesn't contain the character 'E'.
只要字符串参数不包含字符“ E”,此函数就可以正常工作。 I'm wondering if it is a bug in the UrlRoutingModule or something?
我想知道这是UrlRoutingModule中的错误还是什么?
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: 在Edm Model中注册此功能的代码是:
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
并且此网址(包括“ E”)将导致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. 这确实是我们ODataLib实现的URL解析器的错误,已在我们的问题跟踪器中打开了一个Github问题: https : //github.com/OData/odata.net/issues/3 ,并已在我们的内部代码中修复基础。 You should be able to see the fix in our next Nuget release and the corresponding fix code in our next Github source update.
您应该能够在我们的下一个Nuget版本中看到该修复程序,并在我们的下一个Github源代码更新中看到相应的修复程序代码。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.