Open soshman opened 1 month ago
Hello @soshman I am having a hard time reproducing this, could you share the following information:
DbContext
modelBuilder
so it's clear which class you used to construct it).Hi @habbes Sorry for not being precise enough. We use SQL Server database. The configuration we use is complicated, so I created a sample project that shows the same problem.
Here's the repo: sample repo Thanks!
@soshman thanks for sharing the repo. Managed to reproduce the issue. I'll investigate this and try to determine the root cause and get back.
Hi @habbes! Have you got updates on the matter? Thanks!
Same error here trying to select Address which is of complex type GET host/odata/Customers?$select=Id,Name,Address
System.InvalidOperationException: Comparing complex types to null is not supported.
@habbes any progress or plan for that?
While experimenting with OData I've encountered a bug with selecting complex properties.
Setup
I have a Transaction entity that contains Id and Price.
Money is defined as:
The transaction entity is configured this way using EF Fluent API:
My OData configuration is like this:
I don't use Restier or any other libraries. I set up my controller like this:
Data model
Scenario
Calling
/Transactions
and/Transactions(355)
works fine. Calling/Transactions?$select=id,price
and/Transactions(355)?$select=id,price
throwsSystem.InvalidOperationException
withComparing complex types to null is not supported.
message.Call stack
Assemblies
Microsoft.AspNetCore.OData 8.2.5/9.0.0-preview.2/9.0.0-rc.1 Microsoft.EntityFrameworkCore 8.0.6
Additional context
The only relevant thing I was able to find was a bug reported under the GraphQL GitHub page: https://github.com/ChilliCream/graphql-platform/issues/6604 This may be a similar scenario. EF Core 8 was used in both of these solutions.
Thanks in advance for the help.