What is the equivalent of the -IgnoreChanges switch for entity-framework core in CLI?

て烟熏妆下的殇ゞ 提交于 2020-01-16 05:52:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!