Is it possible to tell asp identity to use the same dbcontext as application dbcontext? My tables need to relate to identity table. Each table has createuser and edituser field that linked to identity table. If asp use its own dbcontext, then i have to also add entities and mapping to identity tables to the application dbcontext. Is the a better approach for this situation? I use entity framework code first 6 and and asp mvc 5.
EDIT
Based on answers below, i can use the same dbcontext as long as my dbcontext inherited from IdentityContext.
My question:
Do i still need to create entity class and map manually? How do i map relations between my tables to identityuser?
This is my current dbcontext
public partial class MyContext : DbContext
{
static MyContext()
{
Database.SetInitializer<MyContext>(null);
}
public MyContext()
: base("Name=MyContext")
{
this.Configuration.ProxyCreationEnabled = false;
this.Configuration.LazyLoadingEnabled = false;
}
public new DbSet<TEntity> Set<TEntity>() where TEntity : BaseEntity
{
return base.Set<TEntity>();
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Configurations.Add(new AspNetRoleMap());
modelBuilder.Configurations.Add(new AspNetUserClaimMap());
modelBuilder.Configurations.Add(new AspNetUserLoginMap());
modelBuilder.Configurations.Add(new AspNetUserMap());
modelBuilder.Configurations.Add(new PersonMap());
}