我有ASP.NET Core 1.1项目,我发现 IDesignTimeDbContextFactory
实现,但我不明白我应该在哪里创建这个工厂的实例以及如何使用它来进行正常工作的迁移 . 现在在创建/删除迁移之前,我必须清理并重建解决方案,因为如果没有,我将收到此消息: Unable to create an object of type 'MyDbContext'. Add an implementation of 'IDesignTimeDbContextFactory<MyDbContext>' to the project, or see https://go.microsoft.com/fwlink/?linkid=851728 for additional patterns supported at design time
. 所有上下文数据都在分离的项目中 . 如何使用 IDesignTimeDbContextFactory
实现或我做错了什么?
1 回答
将此类添加到您拥有DbContext的文件夹中 .