c# - Stop EF from checking the model -


the model backing 'applicationdbcontext' context has changed since database created. have happened because model used asp.net identity framework has changed or model being used in application has changed. resolve issue, need update database.  

...yada yada yada...

there's lots of questions on this, commonly accepted solutions aren't working me. frankly i'm fed migrations , prefer ef trusts me tables , columns there use.

  • i've removed __migrations table.
  • i've deleted migrations directory.
  • i've tried enable-migrations -enableautomaticmigrations -force (this gets me model backing 'applicationdbcontext' context has changed since database created error)
  • i've tried update-database (same error)
  • i've tried database.setinitializer<applicationdbcontext>(null) in applicationdbcontext static constructor
  • i've tried changing database.setinitializer<applicationdbcontext>(new nulldatabaseinitializer<applicationdbcontext>())
  • i've tried changing database.setinitializer<applicationdbcontext>(new createdatabaseifnotexists<applicationdbcontext>())

i can't past stupid message. changed database schema , updated classes reflect changes. want work. missing?

ok, here's how got work, , it's pretty simple:

in applicationdbcontext class, have constructor so:

public applicationdbcontext(string connectionstringname)     : base(connectionstringname, dontcheckschema) { } 

...and boolean constant dontcheckschema so:

private const bool dontcheckschema = true; 

...and doesn't bark @ me. lo , behold, works.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -