using Identity.Api.Clean.Domain.Entites; using Microsoft.EntityFrameworkCore; namespace Identity.Api.EntityFrameworkCore { public partial class IdentityContext : DbContext { public IdentityContext() { } public IdentityContext(DbContextOptions options) : base(options) { } public virtual DbSet IdentityRole { get; set; } public virtual DbSet IdentityUser { get; set; } public virtual DbSet IdentityUserOrganizationUnit { get; set; } public virtual DbSet IdentityUserRole { get; set; } public virtual DbSet OrganizationUnit { get; set; } public virtual DbSet OrganizationUnitRole { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { if (!optionsBuilder.IsConfigured) { optionsBuilder.UseMySql("data source=127.0.0.1;initial catalog=Identity;user id=root;password=pwd123456", ServerVersion.Parse("8.0.28-mysql")); } } protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.UseCollation("utf8mb4_0900_ai_ci") .HasCharSet("utf8mb4"); modelBuilder.Entity(entity => { entity.HasComment("角色表"); entity.Property(e => e.Id).HasComment("主键"); entity.Property(e => e.CreationTime).HasComment("创建时间"); entity.Property(e => e.RoleName).HasComment("角色名称"); entity.Property(e => e.TenantId).HasComment("租户Id"); }); modelBuilder.Entity(entity => { entity.HasComment("用户表"); entity.Property(e => e.Id).HasComment("主键Id"); entity.Property(e => e.CreationTime).HasComment("创建时间"); entity.Property(e => e.Email).HasComment("邮箱"); entity.Property(e => e.EmailConfirmed).HasComment("false没配置true配置"); entity.Property(e => e.Gender).HasComment("true男,false女:默认false "); entity.Property(e => e.LockoutEnabled).HasComment("用户是否被锁定true为锁定,false没锁定 "); entity.Property(e => e.LockoutEnd).HasComment("锁定的结束日期 "); entity.Property(e => e.NickName).HasComment("昵称 "); entity.Property(e => e.PasswordHash).HasComment("密码"); entity.Property(e => e.PhoneNumber).HasComment("手机号"); entity.Property(e => e.PhoneNumberConfirmed).HasComment("false没配置true配置 "); entity.Property(e => e.TenantId).HasComment("租户Id"); entity.Property(e => e.UserAccount).HasComment("账户"); }); modelBuilder.Entity(entity => { entity.HasComment("用户组织单位"); entity.Property(e => e.Id).HasComment("主键"); entity.Property(e => e.OrganizationUnitId).HasComment("组织Id"); entity.Property(e => e.TenantId).HasComment("租户Id"); entity.Property(e => e.UserId).HasComment("用户Id"); }); modelBuilder.Entity(entity => { entity.HasComment("用户角色"); entity.Property(e => e.Id).HasComment("主键"); entity.Property(e => e.CreationTime).HasComment("创建时间"); entity.Property(e => e.RoleId).HasComment("角色Id"); entity.Property(e => e.UserId).HasComment("用户Id"); }); modelBuilder.Entity(entity => { entity.HasComment("组织单位"); entity.Property(e => e.Id).HasComment("主键Id"); entity.Property(e => e.Code).HasComment("此组织单位的层次代码。 示例:“00001.00042.00005”。这是组织单位的唯一代码。如果OU层次结构改变,它是可变的。"); entity.Property(e => e.CreationTime).HasComment("创建时间"); entity.Property(e => e.DisplayName).HasComment("此组织单位的显示名称。"); entity.Property(e => e.ParentId).HasComment("父Id Null是根。"); }); modelBuilder.Entity(entity => { entity.HasComment("组织单位成员"); entity.Property(e => e.Id).HasComment("主键Id"); entity.Property(e => e.CreationTime).HasComment("创建时间"); entity.Property(e => e.OrganizationUnitId).HasComment("组织Id"); entity.Property(e => e.RoleId).HasComment("角色Id"); entity.Property(e => e.TenantId).HasComment("租户Id"); }); } } }