是否有明确的解释为什么会引发Update.ReaderModificationCommandBatch.ExecuteAsync异常?

时间:2019-07-16 19:11:07

标签: asp.net-core

我正在尝试执行一个异步任务,以便使用asp.net core中的命令查询将新记录插入到我的数据库中!以及每当我的代码尝试运行此行

await _context.SaveChangesAsync(cancellationToken);

它抛出此异常

  

Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection   连接,CancelationToken cancelToken)

我不知道该怎么办!我什至花了很多时间寻找解决方案。

希望您能提供帮助

这是一个完整的例外

  

stackTrace:“处   Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection   连接,在处有CancellationToken cancellingToken)↵   Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext   _,ValueTuple2参数,CancellationToken cancelToken)在Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync [TState,TResult](TState   状态,Func4操作,Func4 verifySucceeded,CancellationToken
  cancelToken)↵at
  Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList1   entryToSave,CancellationToken cancellingToken)↵在   Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean   acceptAllChangesOnSuccess,CancellationToken cancelToken()在   Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean   acceptAllChangesOnSuccess,CancellationToken cancelToken()在   AN.RSM.Application.Employees.Commands.CreateCustomer.CreateEmployeeCommand.Handler.Handle(CreateEmployeeCommand   请求,CancelationToken cancelToken)在   〜\ Employees \ Commands \ CreateEmployee \ CreateEmployeeCommand.cs:line 69↵   在   AN.RSM.Application.Infrastructure.RequestPerformanceBehaviour2.Handle(TRequest   request,CancellationToken cancellingToken,RequestHandlerDelegate1   接下来)在〜\ RequestPerformanceBehaviour.cs:第25行line   MediatR.Pipeline.RequestPostProcessorBehavior2.Handle(TRequest
  request,CancellationToken cancellingToken,RequestHandlerDelegate1   下一个)↵   MediatR.Pipeline.RequestPreProcessorBehavior2.Handle(TRequest
  request,CancellationToken cancellingToken,RequestHandlerDelegate1   下一个)↵   AN.RSM.WebApis.Areas.Employees.Controllers.EmployeesController.Create(CreateEmployeeCommand   命令)在〜\ Controllers \ EmployeeController.cs:第50行   Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper   映射器,ObjectMethodExecutor执行器,对象控制器,Object []   参数)↵在System.Threading.Tasks.ValueTask`1.get_Result()↵在   Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()   ↵在   Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()   ↵在   Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext   上下文)↵   Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State&   接下来,作用域和作用域,对象和状态,布尔值和isCompleted)   Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()   ↵在   Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()“

0 个答案:

没有答案