I'm trying to use Entity Framework Core Identity in an ASP.NET Core application
I have created Database Context and its interface as follows:
public class AppDbContext : IdentityDbContext<AppUser>, IAppDbContext
{
public AppDbContext (DbContextOptions<AppDbContext> options) : base(options)
{ }
public DbSet<AppUser> AppUser { get; set; }
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
}
public interface IAppDbContext
{
DbSet<AppUser> AppUser { get; set; }
int SaveChanges();
Task<int> SaveChangesAsync();
}
Here the issue is, it shows an error in AppDbContext
, stating
'AppDbContext' does not implement interface member 'IAppDbContext.SaveChangesAsync()'
If the AppDbContext is inherited from the DbContext
insted of IdentityDbContext
error would not appear, but to use Identity it should be inherited from IdentityDbContext
.
How can I get around this?