using BlueWest.Data.Application.Users;
using BlueWest.EfMethods;
using BlueWest.Domain.Model;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace BlueWest.Domain
{
///
/// Application User Db Context
///
[EfGenerator]
public class ApplicationUserDbContext : IdentityDbContext<
ApplicationUser,
ApplicationRole,
string,
ApplicationUserClaim,
ApplicationUserRole,
ApplicationUserLogin,
ApplicationRoleClaim,
ApplicationUserToken>
{
///
[EfGetMany(typeof(ApplicationUserClaimUnique))]
public sealed override DbSet UserClaims { get; set; }
///
[EfGetMany(typeof(ApplicationUserRoleUnique))]
public sealed override DbSet UserRoles { get; set; }
///
[EfGetMany(typeof(ApplicationRoleUnique))]
public sealed override DbSet Roles { get; set; }
///
[EfGetMany(typeof(ApplicationRoleClaimUnique))]
public sealed override DbSet RoleClaims { get; set; }
[EfGetMany(typeof(ApplicationUserUnique))]
[EfUpdateMethods( updateType: typeof(ApplicationUserUnique), returnType: typeof(ApplicationUserUnique), keyPropertyMemberName: nameof(ApplicationUserUnique.Id))]
public sealed override DbSet Users { get; set; }
///
#region Initialization
public ApplicationUserDbContext(DbContextOptions options) : base(options)
{
Database.EnsureCreated();
}
///
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
builder.ConfigureCurrentDbModel();
}
#endregion
}
}