本文介绍了错误运行code第一次迁移更新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
林有我的移民麻烦,我的数据库,我似乎无法找到一个答案,我得到的误差
未找到方法: system.missingMethodException而'System.Data.Entity.Migrations.Builders.TableBuilder`1 System.Data.Entity.Migrations.Builders.TableBuilder`1.Index( System.Linq.Ex pressions.Ex pression`1>,布尔,布尔,System.Object的)。
在Evento.Migrations.initialcreate.Up()
在System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration迁移,DbMigration lastMigration)
在System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration迁移,DbMigration lastMigration)
在System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations,字符串targetMigrationId,字符串lastMigrationId)
在System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations,字符串targetMigrationId,字符串lastMigrationId)
在System.Data.Entity.Migrations.DbMigrator.UpdateInternal(字符串targetMigration)
在System.Data.Entity.Migrations.DbMigrator.c__DisplayClassc.b__b()
在System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(动作mustSucceedToKeepDatabase)
在System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(动作mustSucceedToKeepDatabase)
在System.Data.Entity.Migrations.DbMigrator.Update(字符串targetMigration)
在System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(字符串targetMigration)
在System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
在System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
在System.Data.Entity.Migrations.Design.ToolingFacade.Run(跑垒员亚军)
在System.Data.Entity.Migrations.Design.ToolingFacade.Update(字符串targetMigration,布尔力)
在System.Data.Entity.Migrations.UpdateDatabaseCommand.c__DisplayClass2.b__0()
在System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(动作命令)
未找到方法:'System.Data.Entity.Migrations.Builders.TableBuilder`1 System.Data.Entity.Migrations.Builders.TableBuilder`1.Index(System.Linq.Ex pressions.Ex pression` 1>,布尔,布尔,System.Object的)。
解决方案
我遇到了同样的问题,这里是我如何解决它。我希望这可以帮助别人。
- 从我引用删除实体框架和移除了package.config文件(S)的行。
- 关闭Visual Studio并删除了所有的EntityFramework DLL文件在我的项目文件夹
- 打开Visual Studio中,然后做了清理并生成
- 重新安装实体框架
- 做了全新和重新生成
之后,这是工作。
Im having trouble with my migration to my database and i can't seem to find a answer to the error i am getting
System.MissingMethodException: Method not found: 'System.Data.Entity.Migrations.Builders.TableBuilder`1 System.Data.Entity.Migrations.Builders.TableBuilder`1.Index(System.Linq.Expressions.Expression`1>, Boolean, Boolean, System.Object)'.
at Evento.Migrations.initialcreate.Up()
at System.Data.Entity.Migrations.DbMigrator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ApplyMigration(DbMigration migration, DbMigration lastMigration)
at System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
at System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
at System.Data.Entity.Migrations.DbMigrator.c__DisplayClassc.b__b()
at System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
at System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
at System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String targetMigration)
at System.Data.Entity.Migrations.Design.ToolingFacade.UpdateRunner.Run()
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.AppDomain.DoCallBack(CrossAppDomainDelegate callBackDelegate)
at System.Data.Entity.Migrations.Design.ToolingFacade.Run(BaseRunner runner)
at System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
at System.Data.Entity.Migrations.UpdateDatabaseCommand.c__DisplayClass2.b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Method not found: 'System.Data.Entity.Migrations.Builders.TableBuilder`1 System.Data.Entity.Migrations.Builders.TableBuilder`1.Index(System.Linq.Expressions.Expression`1>, Boolean, Boolean, System.Object)'.
解决方案
I ran into this same issue and here is how I resolved it. I hope this helps someone else.
- I deleted Entity Framework from my References and removed the lines from my package.config file(s).
- Closed Visual Studio and deleted all the EntityFramework DLL files in my project folders
- Opened Visual Studio, then did a Clean and Build
- Re-install Entity Framework
- Did a Clean and Build again
After that, it was working.
这篇关于错误运行code第一次迁移更新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!