简体   繁体   English

在程序集''中找到了多个迁移配置类型。 指定要使用的名称。 在添加迁移

[英]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

You can read more about it here. 你可以在这里阅读更多相关信息

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在程序集“ForApi”中发现了一种以上的迁移配置类型。 指定要使用的名称 - More than one migrations configuration type was found in the assembly 'ForApi'. Specify the name of the one to use Add-Migration一列名称被多次列出 - Add-Migration one column name is listed more than once 在显式迁移挂起时添加迁移 - Add-Migration while there are explicit migrations pending 在程序集“ProjectName”中找不到任何迁移配置类型 - No migrations configuration type was found in the assembly 'ProjectName' 实体框架 - 在程序集中找不到迁移配置类型 - Entity Framework - The migrations configuration type was not be found in the assembly 添加迁移:找不到与参数名称“上下文”匹配的参数 - Add-Migration : A parameter cannot be found that matches parameter name 'Context' NHibernate:如何添加多个程序集? - NHibernate: How to add more than one assembly? 启用迁移已过时。 使用 Add-Migration 开始使用 Migrations - Enable-Migrations is obsolete. Use Add-Migration to start using Migrations 找到多个名为“NewProject.Models.DbContext”的 DbContext 通过使用精确大小写提供其完全限定名称来指定要使用的一个 - More than one DbContext named 'NewProject.Models.DbContext' was found Specify which one to use by providing its fully qualified name using exact case 术语“add-migration”未被识别为 cmdlet 的名称 - The term 'add-migration' is not recognized as the name of a cmdlet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM