user610217
user610217

Reputation:

Stop EF from checking the model

The model backing the 'ApplicationDbContext' context has changed since the database was created. This could have happened because the model used by ASP.NET Identity Framework has changed or the model being used in your application has changed. To resolve this issue, you need to update your database. 

...yada yada yada...

There's lots of questions on SO about this, but the commonly accepted solutions just aren't working for me. Frankly I'm fed up with migrations and I would prefer the EF just trusts me that the tables and columns are there for it to use.

I can't get past that stupid message. I changed my database schema and updated my classes to reflect the changes. I just want this to work. What am I missing?

Upvotes: 2

Views: 523

Answers (1)

user610217
user610217

Reputation:

OK, here's how I got it to work, and it's actually pretty simple:

In my ApplicationDbContext class, I have a constructor like so:

public ApplicationDbContext(string connectionStringName)
    : base(connectionStringName, DontCheckSchema)
{
}

...and a boolean constant DontCheckSchema like so:

private const bool DontCheckSchema = true;

...and now it doesn't bark at me. Lo and behold, it even works.

Upvotes: 1

Related Questions