经历了很多麻烦之后,我运行了Enable-Migrations,我终于正确地使用了命令,以便它在我的项目中创建了Migrations目录。
但是,这是它给我的文件。我已将Using语句移至顶部,并删除了无效的语句,但这就是我所做的全部更改。
原始代码。错误在上面的图像链接中。
internal sealed class Configuration : DbMigrationsConfiguration<RapidDeploy.Models.BloggingContext>
{
public Configuration()
{
AutomaticMigrationsEnabled = false;
}
protected override void Seed(RapidDeploy.Models.BloggingContext context)
{
// This method will be called after migrating to the latest version.
// You can use the DbSet<T>.AddOrUpdate() helper extension method
// to avoid creating duplicate seed data. E.g.
//
// context.People.AddOrUpdate(
// p => p.FullName,
// new Person { FullName = "Andrew Peters" },
// new Person { FullName = "Brice Lambson" },
// new Person { FullName = "Rowan Miller" }
// );
//
}
}
最佳答案
我不知道您哪里出错了,但是在Entity Framework Core中没有Enable-Migrations
命令(或DbMigrationsConfiguration
类)。这些只是实体框架6的事情。