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

Query: Complex case of null check removal #17020

Closed
smitpatel opened this issue Aug 8, 2019 · 3 comments · Fixed by #22216
Closed

Query: Complex case of null check removal #17020

smitpatel opened this issue Aug 8, 2019 · 3 comments · Fixed by #22216
Assignees
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Milestone

Comments

@smitpatel
Copy link
Contributor

        [ConditionalTheory]
        [MemberData(nameof(IsAsyncData))]
        public virtual Task Null_check_removal_applied_recursively(bool isAsync)
        {
            return AssertQuery<Level1>(
                isAsync,
                l1s => l1s.Where(l1 =>
                    (((l1.OneToOne_Optional_FK1 == null
                        ? null
                        : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2) == null
                            ? null
                            : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_FK3) == null
                                ? null
                                : l1.OneToOne_Optional_FK1.OneToOne_Optional_FK2.OneToOne_Optional_FK3.Name) == "L4 01"));

Since each test is wrapped in bracket we currently fail to remove null check.
Translation fails because entity equality will put Id access on conditional expression which is not entity shaper.

@smitpatel
Copy link
Contributor Author

Such query constructs are also generated from AutoMapper (in some cases? Never seen all users with this kind of pattern). Removing milestone to reconsider priority.

@smitpatel
Copy link
Contributor Author

I have an idea for this. Poaching.

@smitpatel smitpatel assigned smitpatel and unassigned maumar Feb 25, 2020
@ajcvickers ajcvickers added this to the Backlog milestone Feb 28, 2020
@Erythnul
Copy link

Hi! Any way I can help move this along? Would love to get back to using AutoMapper's ProjectTo instead of our current workaround.

@smitpatel smitpatel removed the easy-win label Jun 6, 2020
smitpatel added a commit that referenced this issue Aug 25, 2020
Resolves #17020

It is already fixed in some earlier commit
@smitpatel smitpatel added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Aug 25, 2020
@smitpatel smitpatel modified the milestones: Backlog, 5.0.0-rc1 Aug 25, 2020
@ghost ghost closed this as completed in #22216 Aug 25, 2020
ghost pushed a commit that referenced this issue Aug 25, 2020
Resolves #17020

It is already fixed in some earlier commit
@ajcvickers ajcvickers modified the milestones: 5.0.0-rc1, 5.0.0 Nov 7, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-query closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported type-bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants