i have made an application in which i want to add identity api as this api solves all issues regarding registration login,password hashing and all good stuff.
issue is i am using generic repository pattern in my existing project and i break my project in other small projects.
as identity uses code first approach i am also using code first approach in my project what i want whenever a user register(identity) i want to enter data to my application tables as well as i want to enter data identity tables and one more complication is my existing project follows relational DBMS( two or three major tables shared with other tables by foreign key).
please help me regarding this

Tuhin PaulRank #7 · 71.9K reputationPosted Oct 12, 2024, 1:44 PM EDT
public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet MyTable1 { get; set; } public DbSet MyTable2 { get; set; } // Identity API's DbSets are already included in IdentityDbContext }Check with the database schema used by the Identity API. Next create a new database context that will share the same database as your existing project. This context will contain the Identity API's tables and your application's tables.
In the Startup.cs file, configure Identity API to use your shared database context.
public void ConfigureServices(IServiceCollection services) { services.AddDbContext(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); services.AddIdentity() .AddEntityFrameworkStores() .AddDefaultTokenProviders(); }