问题
With Visual Studio one can run the command
Add-Migration InitialCreate -IgnoreChanges
in the Package Manage Console when creating the first migration of the model of an existing database with Code First workflow.
What is the equivalent for CLI? The add command would be like this:
dotnet ef migrations add InitialCreate
but what about the ignore switch?
回答1:
In the absence of any other way, one can empty the Up and Down method blocks of the migration of all code and run database update.
public partial class Initial : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
}
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
来源:https://stackoverflow.com/questions/53210060/what-is-the-equivalent-of-the-ignorechanges-switch-for-entity-framework-core-in