为什么 Entity Framework 中的迁移文件在 up() 和 down() 方法中没有代码?
Why does the migration file in Entity Framework have no code inside the up() and down() methods?
我正在尝试使用名称 InitialModel
创建新的迁移。但是,当我打开迁移文件时,我只能看到空的 up()
和 down()
方法。 up()
方法中应该有 createTable()
方法。我已经删除了迁移,更新了数据库并开始了一个新项目,但是,其中 none 有效。有人可以告诉我如何让迁移文件显示 createTable
方法吗?
public partial class initialModel : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
Print screen of up() and down() methods
Print screen of DbContext
已通过在开始时启用身份验证选项解决此问题。这将创建一个名为 IdentityModel.cs 的模型,其中包含用于在 up() 和 down() 方法中创建方法的代码。
Print screen
我正在尝试使用名称 InitialModel
创建新的迁移。但是,当我打开迁移文件时,我只能看到空的 up()
和 down()
方法。 up()
方法中应该有 createTable()
方法。我已经删除了迁移,更新了数据库并开始了一个新项目,但是,其中 none 有效。有人可以告诉我如何让迁移文件显示 createTable
方法吗?
public partial class initialModel : DbMigration
{
public override void Up()
{
}
public override void Down()
{
}
}
Print screen of up() and down() methods
Print screen of DbContext
已通过在开始时启用身份验证选项解决此问题。这将创建一个名为 IdentityModel.cs 的模型,其中包含用于在 up() 和 down() 方法中创建方法的代码。
Print screen