I am using EF6 with MVC5. I have enabled Migrations and put a Seed method in the Configuration file.
After I deployed to IIS 7, the Seed method keeps running every now and then !! which caused the problem here
My understanding is that it should only run when a migration is done to the DB.
I solved the problem by Publishing again without checking ( Execute Code First Migrations ... )
My question is : why the Seed method was rerunning ?! is it a normal thing ?!
(EDIT)
You were right Yuliam, when I publish and check "Execute Code First Migrations ..." the config file was modified and the following was added:
<contexts>
<context type="...my context here...">
<databaseInitializer type="System.Data.Entity.MigrateDatabaseToLatestVersion`2[[...my context here...], [....Migrations.Configuration, ...]], EntityFramework, PublicKeyToken=some_token">
<parameters>
<parameter value="DefaultConnection_DatabasePublish" />
</parameters>
</databaseInitializer>
</context>
</contexts>
So, is this normal ? and should I delete this every time I publish ?