2022-09-27 20:12:13 +03:00
|
|
|
using BlueWest.Data.Application.Users;
|
2022-09-11 20:45:26 +03:00
|
|
|
using BlueWest.EfMethods;
|
2022-10-30 19:48:24 +03:00
|
|
|
using CodeLiturgy.Domain.Model;
|
2022-09-10 00:33:17 +03:00
|
|
|
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
2022-10-30 19:48:24 +03:00
|
|
|
namespace CodeLiturgy.Domain
|
2022-09-10 00:33:17 +03:00
|
|
|
{
|
2022-09-11 20:45:26 +03:00
|
|
|
/// <summary>
|
|
|
|
/// Application User Db Context
|
|
|
|
/// </summary>
|
|
|
|
[EfGenerator]
|
|
|
|
public class ApplicationUserDbContext : IdentityDbContext<
|
|
|
|
ApplicationUser,
|
|
|
|
ApplicationRole,
|
|
|
|
string,
|
|
|
|
ApplicationUserClaim,
|
|
|
|
ApplicationUserRole,
|
|
|
|
ApplicationUserLogin,
|
|
|
|
ApplicationRoleClaim,
|
|
|
|
ApplicationUserToken>
|
|
|
|
{
|
|
|
|
/// <inheritdoc />
|
2022-09-12 17:57:37 +03:00
|
|
|
[EfGetMany(typeof(ApplicationUserClaimUnique))]
|
2022-09-11 20:45:26 +03:00
|
|
|
public sealed override DbSet<ApplicationUserClaim> UserClaims { get; set; }
|
2022-09-11 01:22:04 +03:00
|
|
|
|
2022-09-11 20:45:26 +03:00
|
|
|
/// <inheritdoc />
|
2022-09-17 22:13:35 +03:00
|
|
|
[EfGetMany(typeof(ApplicationUserRoleUnique))]
|
2022-09-11 20:45:26 +03:00
|
|
|
public sealed override DbSet<ApplicationUserRole> UserRoles { get; set; }
|
2022-09-11 01:22:04 +03:00
|
|
|
|
2022-09-11 20:45:26 +03:00
|
|
|
/// <inheritdoc />
|
2022-09-17 22:13:35 +03:00
|
|
|
[EfGetMany(typeof(ApplicationRoleUnique))]
|
2022-09-11 20:45:26 +03:00
|
|
|
public sealed override DbSet<ApplicationRole> Roles { get; set; }
|
2022-09-11 01:22:04 +03:00
|
|
|
|
2022-09-11 20:45:26 +03:00
|
|
|
/// <inheritdoc />
|
2022-09-17 22:13:35 +03:00
|
|
|
[EfGetMany(typeof(ApplicationRoleClaimUnique))]
|
2022-09-11 20:45:26 +03:00
|
|
|
public sealed override DbSet<ApplicationRoleClaim> RoleClaims { get; set; }
|
2022-09-12 17:57:37 +03:00
|
|
|
|
|
|
|
[EfGetMany(typeof(ApplicationUserUnique))]
|
|
|
|
[EfUpdateMethods( updateType: typeof(ApplicationUserUnique), returnType: typeof(ApplicationUserUnique), keyPropertyMemberName: nameof(ApplicationUserUnique.Id))]
|
|
|
|
public sealed override DbSet<ApplicationUser> Users { get; set; }
|
|
|
|
|
2022-09-11 20:45:26 +03:00
|
|
|
/// <inheritdoc />
|
2022-09-17 22:13:35 +03:00
|
|
|
#region Initialization
|
2022-09-11 20:45:26 +03:00
|
|
|
public ApplicationUserDbContext(DbContextOptions<ApplicationUserDbContext> options) : base(options)
|
|
|
|
{
|
|
|
|
Database.EnsureCreated();
|
|
|
|
}
|
2022-09-10 00:33:17 +03:00
|
|
|
|
2022-09-11 01:22:04 +03:00
|
|
|
|
2022-09-11 20:45:26 +03:00
|
|
|
/// <inheritdoc />
|
|
|
|
protected override void OnModelCreating(ModelBuilder builder)
|
2022-09-10 00:33:17 +03:00
|
|
|
{
|
2022-09-11 20:45:26 +03:00
|
|
|
base.OnModelCreating(builder);
|
2022-09-10 00:33:17 +03:00
|
|
|
|
2022-09-10 07:12:03 +03:00
|
|
|
|
2022-09-17 22:13:35 +03:00
|
|
|
builder.ConfigureCurrentDbModel();
|
2022-09-11 01:22:04 +03:00
|
|
|
|
|
|
|
|
2022-09-11 20:45:26 +03:00
|
|
|
}
|
2022-09-12 17:57:37 +03:00
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
2022-09-10 00:33:17 +03:00
|
|
|
}
|
|
|
|
}
|