How to disable migration in Entity Framework 4.3.1?

agent47 picture agent47 · Mar 14, 2012 · Viewed 57k times · Source

Is there any way to disable migration in Entity Framework 4.3.1? I removed the migrations folder from the project and the generated tables in my database, but it doesn't work! How can you remove the migration?

Answer

Ladislav Mrnka picture Ladislav Mrnka · Mar 14, 2012

If you don't want to use migrations but in the same time you want EF to create database for you, you just need to set correct database initializer:

Database.SetInitializer<YourContextType>(new CreateDatabaseIfNotExists<YourContentType>());