Reputation: 9171
I have a linq to entities application that was working great until someone tried to add a column to a database table.
I was quite surprised to see that the production application crashed because it wanted to run to automatic migration and delete the column. It stopped due to potential dataloss.
How can I have my application run and not try to sync the database up? I would like older versions of my linq to entities code first applications to run alongside the newer versions if the database changes are not breaking changes.
Upvotes: 2
Views: 749
Reputation: 4997
In production, you could...
SetInitializer<YourContext>(null)
on startup or...Disable database initialization using the configuration file
<contexts>
<context type="Namespace.MyContext, MyAssembly"
disableDatabaseInitialization="true" />
</contexts>
Either way, automatic migrations would be disabled (as would the __MigrationsHistory/metadata check...I think).
Upvotes: 3