Using custom user instead of ASP.NET IdentityUser

好久不见. 提交于 2019-12-04 15:01:26

This is what I did in order to get a solution:

  • I removed the base.OnModelCreating
  • Then I added the ignore in this order.

    //base.OnModelCreating(modelBuilder);
    modelBuilder.Entity<IdentityUser>().ToTable("User");
    modelBuilder.Entity<IdentityUser>().ToTable("User").Ignore(p => p.Roles);
    modelBuilder.Ignore<IdentityUserRole>();
    modelBuilder.Ignore<IdentityUserLogin>();
    modelBuilder.Ignore<IdentityUserClaim>();
    modelBuilder.Ignore<IdentityRole>();
    

Doing this I got a final error that it said: Could not drop object 'dbo.Role' because it is referenced by a FOREIGN KEY constraint.

For that I changed the migration moving the DropTable("dbo.Role"). I know this is hack, but I did not find out how EF migrations move the droptables sentences to the right order.

Richard

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!