Tony Bater
Tony Bater

Reputation: 327

Invalid object name 'dbo.AspNetUsers'

I have an MVC5 application using Entity Framework 6.1 and Asp.Net Identity 2 and have data migrations enabled. I have used sample code from other answers on StackExchange to seed the Role and User tables. My application data context is based on IdentityDbContext. On issuing an update-database command, my database is created and populated with the following tables:

List of tables from SQL Server Object Explorer

My app launches OK, but when I try to log in using the seeded user (or any user for that matter), I get the following error: Screen shot of error message

How can I get SignInManager to reference the IdentityUsers table instead of AspNetUsers?

Upvotes: 2

Views: 7928

Answers (1)

fly_ua
fly_ua

Reputation: 1054

You can set custom names in OnModelCreating

protected override void OnModelCreating(DbModelBuilder mb)
{
    base.OnModelCreating(mb);

    mb.Entity<User>().ToTable("IdentityUsers");
   ...
}

Upvotes: 3

Related Questions