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)
inapplicationdbcontext
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
Post a Comment