我有一个迁移类,你可以看到:
public class DataContext : DbContext
{
public DataContext() : base("DefaultConnection")
{
this.Configuration.LazyLoadingEnabled = false;
this.Configuration.ProxyCreationEnabled = false;
Database.SetInitializer(new MigrateDatabaseToLatestVersion<DataContext, MigrationsConfiguration>("DefaultConnection"));
}
public DbSet<Line> Lines { get; set; }
public DbSet<NdtReport> NdtReports { get; set; }
}
迁移类:
public class MigrationsConfiguration : DbMigrationsConfiguration<DataContext>
{
public MigrationsConfiguration()
{
this.AutomaticMigrationDataLossAllowed = true;
this.AutomaticMigrationsEnabled = true;
}
}
在我的一个类中,我删除了一些列并添加了另一列,但是当我运行应用程序时出现此错误:
类型&#39; System.Data.SqlClient.SqlException&#39;未处理的异常 发生在EntityFramework.dll中的附加信息:ALTER TABLE DROP COLUMN失败,因为列&#39; FinNumber&#39;表中不存在 &#39; FitUps&#39;
为什么?