Search code examples
asp.netmodel-view-controllerasp.net-identityef-database-first

Customizing Identity table with database first


Trying to build an application that uses ASP.NET Authentication with Identity.

I've been watching a video on how to do things. They add new properties directly to the ApplicationUser class and then update the database using code-first migrations.

But I'm using database first.

So I added my new properties directly to the ApplicationUser class, and I also added compatible fields to my database. But I still get an error.

The model backing the 'ApplicationDbContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269).

I have Googled this and found articles specifically referencing database first, but they all seem to involve using code first!

Is this even possible to do without code first any more? Or is it just the case where we will all use code first or die?


Solution

  • As @Kyle suggested, this is all based on the __MigrationHistory table.

    I'm not sure exactly how this all works, or what the overhead is if this table is being tested against my data each time I run my software. But renaming the table gets rid of the error. And I'm now able to modify the database as I wish without errors.