I have a problem that's causing hair loss...
I have a project build using Code First (EF); all is well and it works like a charm however, I cannot find a suitable way of allowing for Database changes (via .sql scripts) without the application throwing a tantrum at start-up because the schema has changed.
I have read and read into this problem, I have deleted the EdmMetaData table so it cannot compare the hash of the database but then read there was a bug with the EF in that if this is deleted, it still thinks the schema has changed (as it doesn't recognise the missing table, so it compares an empty string!).
Also, I have tried using the Database.SetInitializer(null) in the Global.asax file but this means I cannot access the Data Model later on.
Everybody talks about using the option of dropping the database if the schema changes etc.
This is what I'm looking for:
For the EF/Code First to do... NOTHING! Sweet FA! Nowt!
... If I change the schema via an external application, I want it to ignore the changes altogether and just ASSUME I have made the relevant model changes to work with these database changes, made via the .sql script. If I miss a column or table, then I accept my stupidity and I expect a tantrum then but, until I make a mistake, I want the EF to trust me.
This means I can easily update any of our client(s) with a .sql script, at any time and not worry about the EF going tits up! :(
ANY ideas guys??