Multiple entity support for ExecuteUpdate#31408
Conversation
| SET [c].[ContactName] = N'Updated' | ||
| FROM [Customers] AS [c] | ||
| WHERE [c].[CustomerID] LIKE N'F%' | ||
| INNER JOIN ( |
There was a problem hiding this comment.
This SQL becomes seemingly more complex. However, the simpler SQL was only the result of logic for ignoring Distinct in cases where it's totally useless (i.e. when placed direct on entity types which have unique PKs, so necessarily a no-op). which doesn't fit so well with the new code. The user can simply remove their useless Distinct() if they want.
There was a problem hiding this comment.
BTW thinking about this, if we really want to remove useless Distincts, that should probably be done more generally in the query pipeline (though again, it's the kind of optimization which only speeds up badly-written LINQ queries).
| /// any release. You should only use it directly in your code with extreme caution and knowing that | ||
| /// doing so can result in application failures when updating to a new Entity Framework Core release. | ||
| /// </summary> | ||
| public sealed class TpcTablesExpression : TableExpressionBase |
There was a problem hiding this comment.
Need to expose it in order to recognize it in ExecuteUpdate translation, to throw the appropriate error message; it's still internal (another part of opening things up a bit).
| } | ||
|
|
||
| // Generate the INNER JOIN around the original query, on the PK properties. | ||
| var outer = (ShapedQueryExpression)Visit(new EntityQueryRootExpression(entityType)); |
There was a problem hiding this comment.
Most of these changes are simply refactoring/moving around the code.
Closes #31406
Fixes #31349