[英]More than one migrations configuration type was found in the assembly ''. Specify the name of the one to use. On add-migration
In Package Manager Console, I'm trying to update my database. 在包管理器控制台中,我正在尝试更新我的数据库。 When I enter this command : 当我输入此命令时:
add-migration Migration1
And I get this : 我得到了这个:
More than one migrations configuration type was found in the assembly 'MyProject.POCO'. 在程序集“MyProject.POCO”中找到了多个迁移配置类型。 Specify the name of the one to use. 指定要使用的名称。
I googled the error and I get this : 我用谷歌搜索了错误,我得到了这个:
add-migration InitialBSchema -IgnoreChanges -ConfigurationTypeName
ConfigurationB -ProjectName ProjectContextIsInIfNotMainOne
-StartupProjectName NameOfMainProject -ConnectionStringName ContextB
But I don't know how to apply this to my project. 但我不知道如何将其应用于我的项目。 What should I write for ConfigurationTypeName? 我应该为ConfigurationTypeName写什么? Or is there a simpler way to do this? 或者有更简单的方法吗? Thanks. 谢谢。
You have multiple DbContext
in your project you will need to indicate which is going to have the database update. 您的项目中有多个DbContext
,您需要指明哪个将更新数据库。 This can be done with -ConfigurationTypeName
. 这可以使用-ConfigurationTypeName
来完成。 The ConfigurationTypeName is the name of your Configuration class in your migration folder. ConfigurationTypeName是迁移文件夹中Configuration类的名称。
Add-Migration -Name Migration1 -ConfigurationTypeName MyProject.POCO.Configuration
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.