简体   繁体   中英

How to make edmx DbContext inherit from IdentityDbContext

Im trying to integrate asp.net identity to my existing project i'm working with Database first, and using edmx to generate the models and context class,

Now in the Context class that is generated with edmx, i need to change the inheritance from DbContext TO IdentityDbContext but when i refresh the edmx all changes gets removed from the Context class,

So my question is how can i inherit from IdentityDbContext when using edmx

Change these

public ConfigurationContext(DbContextOptions<ConfigurationContext> options):base(options)    
public IdentityDbContext (DbContextOptions<IdentityDbContext> options):base(options)

to this

public ConfigurationContext(DbContextOptions options):base(options) 
public IdentityDbContext (DbContextOptions options):base(options)

Example

public class QueryContext : DbContext
{
  public QueryContext(DbContextOptions options): base(options)
   {
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM