How to disable Migrations from a project with EF6?

3

Hello

I have a class library with templates using Code First and I enabled Migrations with the "enable-migrations" command in PMC to test and it works very well. Since I'm at the beginning of the model definitions, I'd rather leave it for after the first production deploy.

How do I disable Migrations from my project?

    
asked by anonymous 21.04.2014 / 20:29

1 answer

3

Place false on AutomaticMigrationsEnabled and when you need it again put true .

Example:

internalsealedclassConfiguration:DbMigrationsConfiguration<YourContext>{publicConfiguration(){AutomaticMigrationsEnabled=false;}}

YoucanalsouseAdd-MigrationInitialSchema-IgnoreChangestocreateanemptymigrationunderthecurrenttemplate.

Inthis link , you have videos and interesting explanations on the subject, although it is in English, the text is very easy to understand.

References

21.04.2014 / 20:46