-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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 support for non-anonymous DTOs #16791
Conversation
5011d20
to
ed4535e
Compare
PS there seems to be considerable potential for DRY (e.g. repeated code between RelationalProjectionBindingExpressionVisitor, InMemoryProjectionBindingExpressionVisitor, CosmosProjectionBindingExpressionVisitor). Any objection to me taking a look? |
ed4535e
to
043a4e4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to re-target to release/3.0 before merging.
@ajcvickers done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While changings look fine, we are not adding support for MemberMemberBinding in 3.0. It was not supported in past. There is only 1 test. In order to add support for whole new expression structure like that, we need to test and make sure it works with
- EE
- Nav expansion
- Translation of non-select in terms of rebinding
- Projection bindings
- Materialization
It would be a risky change to put it in for RTM given lack of time and testing.
cc: @ajcvickers
src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
Show resolved
Hide resolved
A lot of internal states. By making it DRY we may put ourselves in corner in terms of breaking changes. |
But at this point nothing is working with MemberMemberBinding anyway, so we wouldn't be risking or breaking anything, right? Whatever scenarios this unblocks - great - and what it doesn't wouldn't have worked anyway, so we can take care of issues as they come? Put another way, is there a downside/risk to adding partial support for this, even if it's not complete? @ajcvickers @smitpatel let me know what you decide, I can back out this work.
All I meant was moving duplicated methods and state to a single internal base class - since everything stays internal I don't think there's a problem with breaking changes. It seems a bit dangerous to have to do identical changes in three different places. |
Internal code in EF core which providers depend on? We don't do such patterns. |
@roji @smitpatel I chatted with Smit and I think if there are only specific case(s) of |
MemberAssignment supported |
@ajcvickers @smitpatel OK, not sure why we're throwing away valid code already written but I'll back out all support for MemberMemberBinding.
Seems strange to me - everything is already internal now, so refactoring internal with internal to avoid duplication is only an improvement, no? Unless we were planning to make this visitor public? |
@roji I obviously misunderstand. Why are you backing this out? |
Provider.Internal does not depend on EFCore.Internal. |
@smitpatel So you're saying for a provider to use this it must depend on EF internal code? |
@roji Are we talking about two different things here? DRYing up is fine, but public surface has to be reviewed and signed off this late in the game, so doesn't seem worth it to me. We can do this later. With regard to code that understands different bindings, I'm fine with that if we are confident in the change and it doesn't introduce new, untested paths. |
@ajcvickers unless I'm misunderstanding, @smitpatel is asking that I back out all changes that I did to support MemberMemberBinding, because they are not complete support for this expression type and not fully-tested. I personally believe we should consider merging, but I'm OK to back out and revisit later. You can discuss with him.
Providers can reimplement their own ProjectionBindingExpressionVisitor from scratch - that's what Cosmos, InMemory and Relational are doing. However, there's considerable code duplication between them. I'm not proposing adding anything public, just DRYing common code from three largely-duplicated classes in providers into a common base class in EFCore.Internal.
I'm not sure where these rules come from :) |
Making anything DRY between different providers require to put the code in EF.Core assembly. Anything in EFCore which providers depend on needs to be made public. Providers don't depend on types inside .Internal namespace in base EFCore provider. Provider code being inside Internal namespace is irrelevant. |
@roji I pinged you on Teams. This is quite concerning to me--we should follow up as a priority. |
@ajcvickers explained the situation in teams. To sum up the way I understand it:
|
043a4e4
to
fa8affc
Compare
After offline discussion, we'll keep the code duplication to avoid having our providers depend on internal EFCore code. Regardless, updated this PR to not add any MemberMemberBinding support. |
fa8affc
to
7a8058d
Compare
src/EFCore.Cosmos/Query/Internal/CosmosProjectionBindingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
MemberAssignmentBinding only for now. Fixes #16789
7a8058d
to
53d81e0
Compare
Thanks @smitpatel |
Note: opened #16867 to track adding MemberMemberBinding and linked to the work already done, which was backed out of this PR. |
Also various modifications to support MemberMemberBinding better (RelationalProjectionBindingExpressionVisitor, ReplacingExpressionVisitor, ExpressionEqualityComparer)
Fixes #16789
There's probably some specific support for MemberMemberBinding missing from RelationalProjectionBindingExpressionVisitor but I think we can take care of that later.
Note that we still don't support MemberListBinding.