Closed abhinavkumarverma-gmail closed 4 months ago
@abhinavkumarverma-gmail Thanks for reporting this. I think it's related to the case insensitive configuration (by default) for non-EdmModel scenario. See details at: https://github.com/OData/AspNetCoreOData/issues/1190#issuecomment-1986299357.
And It should be fixed in the latest nightly package but haven't released at nuget.org. For nightly, please check the readme of this repository.
Thanks for the reply.
How is this considered completed and closed when there is no 8.2.* version above 8.2.4 where this is fixed? This is a breaking change that actually caused an outage in our product. These shouldn't be closed until there's an available remediation.
Assemblies affected ASP.NET Core OData 8.2.5
Describe the bug I am getting error - Could not find a property named 'keyName' on type 'MyClass' on ASP.NET Core OData 8.2.5, but it is working fine till ASP.NET Core OData 8.2.4 version.
The exception is raised at line "(int)oDataQueryOptions.Count?.GetEntityCount(oDataQueryOptions.Filter?.ApplyTo(myClassQuery, new ODataQuerySettings()) ?? myClassQuery)" mentioned in below code snippet
Reproduce steps
Model
Public class MyClass { [Key] public int AutoId {get;set;} public string KeyName {get;set;} public string Description {get;set;} }
WebAPI
public Task
var response = new { totalRecords = (int)oDataQueryOptions.Count?.GetEntityCount(oDataQueryOptions.Filter?.ApplyTo(myClassQuery, new ODataQuerySettings()) ?? myClassQuery), records = oDataQueryOptions.ApplyTo(myClassQuery).Cast()
};
}
Request/Response Request: https://localhost:8080/api/requests?$format=json&$top=10&$orderby=keyName&$count=true) Response: Could not find a property named 'keyName' on type 'MyClass'
Expected behavior It should return valid object