entity framework - DropCreateDatabaseIfModelChanges -


i trying set initializer used in test environment. read, dropcreatedatabaseifmodelchanges need. times database gets out of sync model, , need start on fresh.

so here how went setting context constructor

public applicationcontext(int dbid, string username) : base(dbid, username) {      database.setinitializer<applicationcontext>(new dropcreatedatabaseifmodelchanges<applicationcontext>());      database.initialize(true);  } 

however, when have initializer set up, still error:

"the model backing "applicationcontext" has changed since database created. consider using code first migrations update database"

some other things note:

  1. i have tried setting automicmigrationsenabled = false true in migrations config file.
  2. i have tried , without forcing initialization

anybody run same issue or have ideas?

update able through source code system.data.entity here: https://github.com/hallco978/entityframework/tree/master/src/entityframework

it turns out needed outright delete migrations/configuration.cs file prevent error. doesn't matter settings within configuration file.

i know problem because can't drop database if i'm using it. know if deletedatabase means drop entire database or tables model created?


Comments

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -