AspNetCoreOData icon indicating copy to clipboard operation
AspNetCoreOData copied to clipboard

Fix duplicate JOIN statements when expanding an IQueryable that already has a join

Open ElizabethOkerio opened this issue 2 years ago • 0 comments

Fixes https://github.com/OData/AspNetCoreOData/issues/1035

In this fix https://github.com/OData/AspNetCoreOData/pull/993 we added a fix to remove duplicate joins from the generated sql. This involved making updates to the Instance property of the expression to be created and only including structural properties.

The changes led to this being generated:

{ Instance = new Customer() {Id = $it.Id, Name= $it.Name}}

Instead of this:

{ Instance = $it }

These changes did not take into consideration query settings. I've added checks for nullability and handling null propagation and creating a conditional expression.

ElizabethOkerio avatar Sep 04 '23 08:09 ElizabethOkerio