zzzprojects / EntityFramework-Plus

Entity Framework Plus extends your DbContext with must-haves features: Include Filter, Auditing, Caching, Query Future, Batch Delete, Batch Update, and more
https://entityframework-plus.net/
MIT License
2.27k stars 318 forks source link

Error when trying to batch delete in EF Core 3.0 preview 4 #477

Closed mhosman closed 5 years ago

mhosman commented 5 years ago

await _context.TeamUsers.Where(c => c.UserId == user.Id).DeleteAsync();

An unhandled exception occurred while processing the request.

MissingMethodException: Method not found: 'Microsoft.EntityFrameworkCore.Storage.IRelationalCommand Microsoft.EntityFrameworkCore.Query.Sql.IQuerySqlGenerator.GenerateSql(System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object>)'. Z.EntityFramework.Plus.InternalExtensions.CreateCommand(IQueryable source, out RelationalQueryContext queryContext)

fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]
      An unhandled exception has occurred while executing the request.
System.MissingMethodException: Method not found: 'Microsoft.EntityFrameworkCore.Storage.IRelationalCommand Microsoft.EntityFrameworkCore.Query.Sql.IQuerySqlGenerator.GenerateSql(System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object>)'.
   at Z.EntityFramework.Plus.InternalExtensions.CreateCommand(IQueryable source, RelationalQueryContext& queryContext)
   at Z.EntityFramework.Plus.BatchDelete.CreateCommand(IQueryable query, IEntityType entity)
   at Z.EntityFramework.Plus.BatchDelete.Execute[T](IQueryable`1 query)
   at CustomerApi.Controllers.UsersController.PatchUser(Int32 id, JsonPatchDocument`1 patchDocument) in C:\Users\user\Documents\GitHub\api\Api\Controllers\User\UsersController.cs:line 724
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at System.Threading.Tasks.ValueTask`1.get_Result()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context, ICorsPolicyProvider corsPolicyProvider)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Routing.EndpointRoutingMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at CustomerApi.Startup.<>c.<<Configure>b__5_0>d.MoveNext() in C:\Users\user\Documents\GitHub\api\Api\Startup.cs:line 119
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: Error: An unhandled exception has occurred while executing the request.
JonathanMagnan commented 5 years ago

Hello @mhosman ,

Thank you for reporting,

The v3.x is not yet supported but should be looked very soon. Probably next week.

Best Regards,

Jonathan

JonathanMagnan commented 5 years ago

Hello @mhosman ,

The v1.8.27 has been released.

We added the support to EF Core 3.0 preview 4 in this version.

Let me know if everything correctly

Best Regards,

Jonathan

mhosman commented 5 years ago

Great @JonathanMagnan, thank you very much!!!