asp.net-core - EF Core 迁移错误 : "Unable to create an object of type ' ApplicationContext'"

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

我正在尝试使用 EF Core 进行迁移,但出现错误 - 如何修复此错误?

PM> add-migration ini

Unable to create an object of type 'ApplicationContext'. Add an implementation of 'IDesignTimeDbContextFactory' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time.

最佳答案

如果您有多个启动项目,也会发生这种情况 - 迁移时,只需选择一个(在 VS 中右键单击解决方案并设置启动项目...)

关于asp.net-core - EF Core 迁移错误 : "Unable to create an object of type ' ApplicationContext'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51343295/

相关文章:

c# - 如何从 EF Core 中的模型生成类图?

c# - PredicateBuilder 不适用于 EF Core

c# - Dotnet 核心 3.1 版本的 RelationalMetadataExtensions.Relations()

c# - EF Core 创建多个外键列

azure - Kestrel 运行哪个框架?

c# - 在 ASP.NET Core 中更改 Controller 路由

c# - 读取 Main Program.cs 中的 appsettings.json

c# - 在两个 ASP.NET Core 应用程序之间共享 Cookie

jenkins - 使用.NET Core使用xunit生成结果报告测试

.net-core - 结合 .NET Core 2.2 和 3.0 项目