AspNetCoreOData
AspNetCoreOData copied to clipboard
getting-related-entities convention conflicted with ODataConventionModelBuilder.EnableLowerCamelCase()
Assemblies affected ASP.NET Core OData 8.0.8
Describe the bug
when ODataConventionModelBuilder.EnableLowerCamelCase()
is enabled, the controller method described here will not be hit if the method name is GetSupplier
. However it will be hit if the method is Getsupplier
(lowercase s).
Expected behavior
GetSupplier
should work regardless the status of EnableLowerCamelCase()
.
You can enable a lot of routing options, for routing does that help?
builder.Services.AddControllers()
.AddOData((options, serviceProvider) =>
{
options.RouteOptions.EnableKeyInParenthesis = true;
options.RouteOptions.EnableNonParenthesisForEmptyParameterFunction = true;
options.RouteOptions.EnableQualifiedOperationCall = true;
options.RouteOptions.EnableUnqualifiedOperationCall = true;
options.RouteOptions.EnablePropertyNameCaseInsensitive = true;
options.RouteOptions.EnableControllerNameCaseInsensitive = true;
options
.Count().Filter().Expand().Select().OrderBy().SetMaxTop(1000);
})
I can confirm that options.RouteOptions.EnableControllerNameCaseInsensitive = true
did not help the issue.
@sep2 this should be fixed in 8.0.9. Can you update, test again and close this if it is fixed for you?
@sep2 this should be fixed in 8.0.9. Can you update, test again and close this if it is fixed for you?
I tried 8.0.9 and the result is same, Getsupplier
can work while GetSupplier
cannot.
@sep2 Can you share with me your startup.cs and the whole controller?
Are you using conventional routing or attribute routing?
@xuzhg Please see the repro here. https://github.com/sep2/odata-test-lowercase
Notice https://github.com/sep2/odata-test-lowercase/blob/main/ODataTest/EventsController.cs#L22 this can work because it is in lower case.
If I change that line to GetActivities
, it won't work then.