-
Notifications
You must be signed in to change notification settings - Fork 358
Open
Labels
Description
Describe the bug
It does not appear to be possible to make the .NET OData client work with case-insensitive / lower-camel-case OData APIs.
When results are being materialized by the client library, properties fail to match due to case sensitive string comparison, even when ODataMessageReaderSettings.EnablePropertyNameCaseInsensitive is set to true, e.g. in the OnMessageReaderSettingsCreated event.
This means all received entities have default values for all properties.
Assemblies affected
Microsoft.OData.Client 8.x and 9.0.0-preview.3.
Steps to Reproduce
- Configure OData API with
ModelBuilder.ModelBuilderFactoryreturning aODataConventionModelBuilderwithEnableLowerCamelCaseForPropertiesAndEnums. - I also have
RouteOptionsEnableControllerNameCaseInsensitive,EnableActionNameCaseInsensitive, andEnablePropertyNameCaseInsensitiveset to true, though I don't think this matters. - Configure OData Client as follows:
Configurations.ResponsePipeline.OnMessageReaderSettingsCreated(settings =>
{
settings.Settings.EnablePropertyNameCaseInsensitive = true;
});Expected behaviour
I would expect the properties to be populated using the values from the lower-camel-case properties received from the API.
Actual behaviour
All properties have default values, i.e. 0 or "" or null.
Additional details
See discussion at #3133.
LRasile and AuburgLRasile