-
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
Move ExecuteUpdate/ExecuteDelete to core so non-relational providers can implement #34257
Conversation
/cc @damieng |
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.
LGTM, see the notes about moving up the dispatch for update/delete, and also not sure we should implement the test suites for InMemory.
case nameof(EntityFrameworkQueryableExtensions.ExecuteDeleteAsync): | ||
case nameof(EntityFrameworkQueryableExtensions.ExecuteUpdate): | ||
case nameof(EntityFrameworkQueryableExtensions.ExecuteUpdateAsync): | ||
return ProcessUnknownMethod(methodCallExpression); |
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.
We should implement proper nav expansion for ExecuteUpdate (see #32493), but this can be done separately in another PR (this doesn't make things any worse than the current situation, even if it doesn't make them better).
test/EFCore.InMemory.FunctionalTests/BulkUpdates/FiltersInheritanceBulkUpdatesInMemoryTest.cs
Outdated
Show resolved
Hide resolved
One more thought... We should follow the pattern of adding TranslateExecuteUpdate/Delete methods to QueryableMethodTranslatingExpresionVisitor, and dispatching to them from the big method dispatch like with the others. Rather than making them abtract like the others, we should just provide a default implementation that adds a specific error message "your provider does not support ExecuteUpdate/Delete" and returns null. Relational would simply override these methods rather than implementing its own special dispatch in VisitMethodCall (which should be removed). |
src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs
Outdated
Show resolved
Hide resolved
…can implement Fixes #31052
@roji I moved the dispatch to core. |
@roji Helps if I actually push the commit. |
@@ -138,6 +138,32 @@ protected override Expression VisitExtension(Expression extensionExpression) | |||
protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression) | |||
{ | |||
var method = methodCallExpression.Method; | |||
|
|||
if (method.DeclaringType == typeof(EntityFrameworkQueryableExtensions)) |
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'd just merge this into the block below, this would deduplicate the visitation, check for SQE, etc. (we check on the generic methods for each case anyway)
{ | ||
var queryable = context.Set<OrderDetail>().FromSqlRaw( | ||
NormalizeDelimitersInRawString( | ||
@"SELECT [OrderID], [ProductID], [UnitPrice], [Quantity], [Discount] |
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.
nit: raw literal string (and below)
Fixes #31052