Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Entity equality causes translation failure inside projection #21157

Closed
roji opened this issue Jun 6, 2020 · 2 comments
Closed

Entity equality causes translation failure inside projection #21157

roji opened this issue Jun 6, 2020 · 2 comments

Comments

@roji
Copy link
Member

roji commented Jun 6, 2020

The following fails:

_ = await context.Blogs
    .Select(b => new
    {
        Foo = b.BlogDetails == null ? null : new
        {
            b.BlogDetails.Id
        }
    })
    .Where(x => x.Foo != null)
    .ToListAsync();

The expression tree after preprocessing:

[Microsoft.EntityFrameworkCore.Query.QueryRootExpression]
    .LeftJoin([Microsoft.EntityFrameworkCore.Query.QueryRootExpression], b => Property(b, "BlogDetailsId"), b0 => Property(b0, "Id"), (o, i) => new TransparentIdentifier`2(Outer = o, Inner = i))
    .Where(b => (IIF((b.Inner == null), null, new <>f__AnonymousType1`1(Id = b.Inner.Id)) != null))
    .Select(b => new <>f__AnonymousType0`1(Foo = IIF((b.Inner == null), null, new <>f__AnonymousType1`1(Id = b.Inner.Id))))

The b.Inner == null causes translation failure.

Originally flagged by @mdmoura in #21148

@smitpatel
Copy link
Contributor

Duplicate of #17020

Wrong title.

@smitpatel
Copy link
Contributor

Comparing IIF((b.Inner == null), null, new <>f__AnonymousType11(Id = b.Inner.Id))` to null fails in translation.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants