asp.net-core - System.MissingMethodException : Method not found: 'UInt32 Npgsql. NpgsqlStatement.get_Rows()

标签 asp.net-core entity-framework-6 npgsql

从今天早上开始,当我更新或插入数据库中的任何内容时,我都会收到此错误。这没有任何问题。找不到任何解决此问题的方法。

Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while updating the entries. See the inner exception for details. ---> System.MissingMethodException: Method not found: 'UInt32 Npgsql.NpgsqlStatement.get_Rows()'.
   at Npgsql.EntityFrameworkCore.PostgreSQL.Update.Internal.NpgsqlModificationCommandBatch.Consume(RelationalDataReader reader)
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.Execute(IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(DbContext _, ValueTuple`2 parameters)
   at Npgsql.EntityFrameworkCore.PostgreSQL.Storage.Internal.NpgsqlExecutionStrategy.Execute[TState,TResult](TState state, Func`3 operation, Func`3 verifySucceeded) in C:\projects\EFCore.PG\src\EFCore.PG\Storage\Internal\NpgsqlExecutionStrategy.cs:line 51
   at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.Execute(IEnumerable`1 commandBatches, IRelationalConnection connection)
   at Microsoft.EntityFrameworkCore.Storage.RelationalDatabase.SaveChanges(IReadOnlyList`1 entries)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(IReadOnlyList`1 entriesToSave)
   at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges(Boolean acceptAllChangesOnSuccess)
   at Microsoft.EntityFrameworkCore.DbContext.SaveChanges()
   at App.Controllers.HomeController.NeuerEintrag(TelefonListe neuerEintrag) in D:\App\Controllers\HomeController.cs:line 128
   at lambda_method(Closure , Object , Object[] )
   at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.StaticFiles.StaticFileMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
Ausnahme ausgelöst: "System.NotImplementedException" in System.Private.CoreLib.dll
Ausnahme ausgelöst: "System.NotImplementedException" in System.Private.CoreLib.dll
Microsoft.AspNetCore.Hosting.Internal.WebHost:Information: Request finished in 600.8631ms 500 text/html; charset=utf-8
Der Thread 0x2bac hat mit Code 0 (0x0) geendet.
Der Thread 0x1b8 hat mit Code 0 (0x0) geendet.
Das Programm "[11660] dotnet.exe" wurde mit Code -1 (0xffffffff) beendet.

最佳答案

您可能已升级到新的 Npgsql 4.1.0,同时保留 EF Core 2.2 - 不幸的是,4.1.0 中发生了重大更改,这使得它们不兼容 ( see this issue )。

Npgsql 4.1.1(即将发布)应该会再次兼容。同时,您可以尝试更新到 EF Core 3.0,它应该可以与 Npgsql 4.1.0 很好地配合。

关于asp.net-core - System.MissingMethodException : Method not found: 'UInt32 Npgsql. NpgsqlStatement.get_Rows(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58166898/

相关文章:

entity-framework - 用于 postgresql 和 ado.net 实体数据模型的 MultipleActiveResultSets

python - 如何在 .NET-Core 应用程序中使用 Python?

angular - ABP (AspNet Boilerplate) API 的间歇性 CORS 策略问题

c# - 使用 EF6 执行 UPSERT 的更有效方法

c# - 如何填充 ItemsControl 中的外键字段?

c# - 类库输出类型中的 Npgsql 程序集错误

c# - 如何确定 IResourceFilter 中的 Controller 名称和 Action 名称?

c# - 如何创建同时面向 .NET 2.0 和 .NET Standard 的库?

entity-framework - 无法在服务器上加载 EntityFramework DatabaseLogger 拦截器

ajax - 使用 VB.NET、AJAX 和 NPGSQL 连接到 PostgreSQL