我用数据迁移在mysql中创建了数据库表XpqCompany,创建成功后,我想修改表名,改为xpqCompanies,然后运行命令 update-database后就报错了,
Specify the '-Verbose' flag to view the SQL statements being applied to the target database.
No pending explicit migrations.
Applying automatic migration: 201605210952113_AutomaticMigration.
MySql.Data.MySqlClient.MySqlException (0x80004005): Can't find file: '.\xpq\dbo@002expqcompany.frm' (errno: 2 - No such file or directory)
在 MySql.Data.MySqlClient.MySqlStream.ReadPacket()
在 MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
在 MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
在 MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
在 MySql.Data.MySqlClient.MySqlDataReader.NextResult()
在 MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
在 MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery()
在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.<NonQuery>b__0(DbCommand t, DbCommandInterceptionContext`1 c)
在 System.Data.Entity.Infrastructure.Interception.InternalDispatcher`1.Dispatch[TTarget,TInterceptionContext,TResult](TTarget target, Func`3 operation, TInterceptionContext interceptionContext, Action`3 executing, Action`3 executed)
在 System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.NonQuery(DbCommand command, DbCommandInterceptionContext interceptionContext)
在 System.Data.Entity.Internal.InterceptableDbCommand.ExecuteNonQuery()
在 System.Data.Entity.Migrations.DbMigrator.ExecuteSql(MigrationStatement migrationStatement, DbConnection connection, DbTransaction transaction, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.ExecuteSql(MigrationStatement migrationStatement, DbConnection connection, DbTransaction transaction, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable`1 migrationStatements, DbConnection connection, DbTransaction transaction, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsWithinTransaction(IEnumerable`1 migrationStatements, DbTransaction transaction, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsWithinNewTransaction(IEnumerable`1 migrationStatements, DbConnection connection, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable`1 migrationStatements, DbConnection connection, DbInterceptionContext interceptionContext)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatementsInternal(IEnumerable`1 migrationStatements, DbConnection connection)
在 System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClass30.<ExecuteStatements>b__2e()
在 System.Data.Entity.Infrastructure.DefaultExecutionStrategy.Execute(Action operation)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable`1 migrationStatements, DbTransaction existingTransaction)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteStatements(IEnumerable`1 migrationStatements)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.ExecuteStatements(IEnumerable`1 migrationStatements)
在 System.Data.Entity.Migrations.DbMigrator.ExecuteOperations(String migrationId, VersionedModel targetModel, IEnumerable`1 operations, IEnumerable`1 systemOperations, Boolean downgrading, Boolean auto)
在 System.Data.Entity.Migrations.DbMigrator.AutoMigrate(String migrationId, VersionedModel sourceModel, VersionedModel targetModel, Boolean downgrading)
在 System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.AutoMigrate(String migrationId, VersionedModel sourceModel, VersionedModel targetModel, Boolean downgrading)
在 System.Data.Entity.Migrations.DbMigrator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
在 System.Data.Entity.Migrations.Infrastructure.MigratorLoggingDecorator.Upgrade(IEnumerable`1 pendingMigrations, String targetMigrationId, String lastMigrationId)
在 System.Data.Entity.Migrations.DbMigrator.UpdateInternal(String targetMigration)
在 System.Data.Entity.Migrations.DbMigrator.<>c__DisplayClassc.<Update>b__b()
在 System.Data.Entity.Migrations.DbMigrator.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.EnsureDatabaseExists(Action mustSucceedToKeepDatabase)
在 System.Data.Entity.Migrations.DbMigrator.Update(String targetMigration)
在 System.Data.Entity.Migrations.Infrastructure.MigratorBase.Update(String 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(BaseRunner runner)
在 System.Data.Entity.Migrations.Design.ToolingFacade.Update(String targetMigration, Boolean force)
在 System.Data.Entity.Migrations.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
在 System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Can't find file: '.\xpq\dbo@002expqcompany.frm' (errno: 2 - No such file or directory)
修改表的字段名,删除表的字段,删除表,添加表等操作都是好,就是修改表名字的时候报错,不是很懂MySQL,所以不知道是不是MySql的问题
老弟,我们都知道ef连接mysql各种坑,你怎么还在玩
公司数据库要用mysql,我也无能为力啊。。就想问问这个有没有直接点的解决方法
@XPQueen: 一狠心换成mybatis.net,啥都搞定了。
@上帝之城: 这工作量太大了。。我也有其他的解决方案。只是太过繁琐。。
@XPQueen: 你既然想换一匹马,总要换个鞍吧