Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 491
nikan Avatar asked Nov 08 '18 14:11

nikan


People also ask

What is the alternative for Entity Framework Core?

Entity Framework, NHibernate, Hibernate, SQLAlchemy, and Sequelize are the most popular alternatives and competitors to Entity Framework Core.

What is core CLI?

The . NET Core command-line interface (CLI) is a new cross-platform tool for creating, restoring packages, building, running and publishing . NET applications. We created our first ASP.NET Core application using Visual Studio in the previous chapter.

Which of the following tool is used to execute the ef core command?

The Package Manager Console (PMC) tools for Entity Framework Core perform design-time development tasks. For example, they create migrations, apply migrations, and generate code for a model based on an existing database. The commands run inside of Visual Studio using the Package Manager Console.

How do I run ef core migrations?

Install the tools First, you'll have to install the EF Core command-line tools: We generally recommend using the . NET Core CLI tools, which work on all platforms. If you're more comfortable working inside Visual Studio or have experience with EF6 migrations, you can also use the Package Manager Console tools.


1 Answers

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)
    {
    }
}
like image 189
nikan Avatar answered Sep 22 '22 00:09

nikan