-
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
Query: Remove public setters from custom expression properties #19346
Conversation
src/EFCore.Relational/Query/Internal/CaseWhenFlatteningExpressionVisitor.cs
Show resolved
Hide resolved
src/EFCore.Relational/Query/Internal/CaseWhenFlatteningExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
src/EFCore.Relational/Query/Internal/CaseWhenFlatteningExpressionVisitor.cs
Show resolved
Hide resolved
@@ -47,12 +47,25 @@ protected override Expression VisitExtension(Expression extensionExpression) | |||
{ | |||
Check.NotNull(extensionExpression, nameof(extensionExpression)); | |||
|
|||
return extensionExpression switch | |||
#pragma warning disable IDE0066 // Convert switch statement to expression | |||
switch (extensionExpression) |
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.
This should stay a switch expression... all the expressions are completely simple.
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.
First case is multi-line.
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.
Didn't we have this discussion already (or similar)? We have multi-line in conditional cases as well, which are also expressions (even nested multi-line)...
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.
Not to mention the ugliness of having to have a pragma around this...
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.
It does not look simple to me. I am not changing it.
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.
I do not consider this to be simple. The design meeting discussion we had specified guidelines to consider simple to be returning a specific value or calling into one method call. Nesting/Chaining is not something I consider simple.
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.
Also design meeting decision was not to use newer feature if something is not agreeable.
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.
I think we should discuss again with the team.
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.
Just extract the first case to a method, then it becomes simple enough
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.
I don't think we came to a consensus on this.
dd4b466
to
0b33f11
Compare
Resolves #19192 Changes - Only server side query expression are in place updated using private setters, public methods - Moved to Update method pattern in certain cases - TableExpressionBase still has internal set which will be fixed in #17337 - ShapedQueryExpression.VisitChildren throws now. Since ShapedQuery contains query expression (server side) and shaper expression (client side), it is unlikely that a visitor needs to visit both components. Hence we force visitor to decide which component to visit. This improves perf as we wouldn't go into client side shaper when updating something in sql tree
0b33f11
to
c41a2f1
Compare
Resolves #19192
Changes