Search code examples
code-firstentity-framework-migrationsentity-framework-4.3

How to disable migration in Entity Framework 4.3.1?


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?


Solution

  • 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>());