tuitio/IdentityServer.Domain.Data/DbContexts/IdentityDbContext.cs

30 lines
1.1 KiB
C#

using IdentityServer.Domain.Data.EntityTypeConfiguration;
using IdentityServer.Domain.Entities;
using Microsoft.EntityFrameworkCore;
namespace IdentityServer.Domain.Data.DbContexts
{
public class IdentityDbContext : DbContext
{
public DbSet<AppUser> Users { get; set; }
public DbSet<UserToken> UserTokens { get; set; }
public IdentityDbContext(DbContextOptions<IdentityDbContext> options)
: base(options)
{
base.ChangeTracker.QueryTrackingBehavior = QueryTrackingBehavior.TrackAll;
base.ChangeTracker.AutoDetectChangesEnabled = true;
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfiguration(new UserStatusConfiguration());
modelBuilder.ApplyConfiguration(new AppUserConfiguration());
modelBuilder.ApplyConfiguration(new UserClaimConfiguration());
modelBuilder.ApplyConfiguration(new UserTokenConfiguration());
}
}
}