我刚刚安装EF 4.3-beta1的迁移善良,我不能得到它的工作。错误我得到:实体框架4.3迁移错误
PM> Update-Database -Verbose
Using NuGet project 'Project.Domain'.
Using StartUp project 'ProjectWebSite'.
System.InvalidOperationException: No migrations configuration type was found in the assembly 'Project.Domain'.
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindConfiguration()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
No migrations configuration type was found in the assembly 'Project.Domain'.
我添加了一个新列2 EF类:
public class MasterInstance
{
public int MasterInstanceId { get; set; }
[Required] public string HostName { get; set; }
[Required] public string Name { get; set; } /* <-- THIS IS NEW */
[Required] public string ConnectionString { get; set; }
public virtual ICollection<MasterInstanceLocation> MasterInstanceLocations { get; set; }
}
而且我的DbContext是这样的:
public class ProjectDontext: DbContext, IProjectContext
{
public IDbSet<Installer> Installers { get; set; }
public IDbSet<MasterInstance> MasterInstances { get; set; }
public IDbSet<MasterInstanceLocation> MasterInstanceLocations { get; set; }
}
任何想法?我的EF类&上下文位于单独的程序集(Project.Domain)中。我已经尝试在主网站和域项目的上下文中运行更新数据库,并且我以同样的方式得到相同的错误。
- 编辑 -
发现的解决方案。事实证明,您需要为您的项目启用迁移。你可以通过在NuGet控制台中运行Enable-Migrations
来做到这一点(确保你选择了正确的项目 - 对我来说这是project.domain项目)。
This walkthrough提供了更多的信息,发现
您的问题是Google的最佳搜索结果*在程序集*中未找到迁移配置类型。这是测试版软件还是非常新的。我会尽量在MSDN论坛上发布。 – Yuck 2012-01-30 13:09:08
Good call - http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/39edecbf-267d-4e88-bad9-87c60f330d8a – 2012-01-30 13:26:11
你有Project.Domain下的迁移文件夹吗 – 2012-01-30 14:17:02