0

Currently, I have EF working perfectly fine with asp net core identity. My web app allows users to login in 2 ways: using their local account and using their azure active directory account. However, only the allowed azure directory accounts are allowed to log in. Therefore, I need to create another table to hold those accounts to cross check when they log in.

1 Answer 1

1

If you want to create a new table for the Identity project, I suggest you could try to modify the identity EF's dbcontext with the new create model class.

More details, you could refer to below codes:

public class UserRelationship
{

    public int UserId { get; set; }
}

Modify the ApplicationDbContext :

public class ApplicationDbContext : IdentityDbContext
{
    public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
        : base(options)
    {
    }

    public DbSet<UserRelationship> UserRelationships { get; set; }
}

Then you could enable the migration and update the database like this article shows.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. I ended up using exactly same approach that you proposed :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.