How to disable EntityFramework Core migrations?

Question

How to disable basic Entity Framework database migrations?

Information

When I created the ASP.NET Core 1.0 MVC website with Identity Core (which uses EF Core), I did the following:

  • Changed connection string for specifying SQL Express instance
  • I opened the website and went to the registration screen.
  • The database was created automatically

Now I want nothing else to be updated automatically through Database Migrations. I want the control to be able to enable / disable migrations.

ApplicationDbContextdoes not seem to be initialized, as was done in the past, that is, it automatically updated the model, for example. CreateIfNotExists.

I would prefer to manually make changes to the SQL server, rather than risk losing data, sometimes I will gladly give him the opportunity to perform the update.

I need a choice.

The following website suggests that the magic is not met, the challenges EnsureCreated, and Migrateto be called - so how can I stop it from calling ASP.NET Identity ie on ApplicationDbContext? https://docs.efproject.net/en/latest/efcore-vs-ef6/porting/ensure-requirements.html

I do not mind if ASP.NET Identity Core has a create command, but how do I know that ASP.NET Identity does not have a method Migrate()that affects the general ApplicationDbContext, which affects tables other than those related to identification?

My environment

  • VS2015
  • "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0"
  • "Microsoft.AspNetCore.Mvc": "1.0.0"

, , - - , !

+4

Source: https://habr.com/ru/post/1648173/


All Articles