Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable migration in Entity Framework 6.0

I'm trying to ignore the "Automatic" migration using Entity Framework 6.0 rc1. My problem is that I don't want this feature right now and every time that my application runs I can see all entity logs trying to create all tables.

Anticipate thanks.

like image 510
Michel Borges Avatar asked Sep 06 '13 21:09

Michel Borges


People also ask

Can I use EF core without migration?

Hi @PanagiotisKanavos, as you mentioned, it does not require migration.

How do I turn on automatic migration in Entity Framework?

Open the Package Manager Console from Tools → Library Package Manager → Package Manager Console and then run the enable-migrations –EnableAutomaticMigration:$true command (make sure that the default project is the project where your context class is).


1 Answers

Try this:

internal sealed class Configuration : DbMigrationsConfiguration<YourContext> {     public Configuration()     {         AutomaticMigrationsEnabled = false;     } } 

UPDATE:

You can also try this:

Database.SetInitializer<YourContextType>(new CreateDatabaseIfNotExists()); 
like image 110
SeyedPooya Soofbaf Avatar answered Oct 12 '22 21:10

SeyedPooya Soofbaf