我们的添加迁移通常会失败但不一致。迁移总是进入脚手架步骤,然后大约5次中有4次我们将收到如下内容:
System.Runtime.Remoting.RemotingException: Object '/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem' has been disconnected or does not exist at the server.at EnvDTE.Project.get_Properties()
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetPropertyValue[T] (Project project, String propertyName)
at System.Data.Entity.Migrations.Extensions.ProjectExtensions.AddFile(Project project, String path, String contents)
at System.Data.Entity.Migrations.Utilities.MigrationWriter.Write(ScaffoldedMigration scaffoldedMigration, Boolean rescaffolding, Boolean force, String name)
at System.Data.Entity.Migrations.AddMigrationCommand.<>c__DisplayClass3.<.ctor>b__1()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Object '/2355037d_df43_460b_8737_725c0c1c80be/hvdculybngjc_rcnskixmk7+_2.rem' has been disconnected or does not exist at the server.
有时迁移类会生成,但更常见的情况是它不会生成。对这个错误的搜索表明,垃圾收集的内容本来不应该是,但这并没有真正帮助我们解决这个问题。
我们的数据迁移项目在.NET 4.5中,EF 5在Windows 8,Visual Studio 2012和SQL Server 2012中运行。