using Fengling.AuthService.Models; using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; namespace Fengling.AuthService.Data; public class ApplicationDbContext : IdentityDbContext { public ApplicationDbContext(DbContextOptions options) : base(options) { } public DbSet OAuthApplications { get; set; } protected override void OnModelCreating(ModelBuilder builder) { base.OnModelCreating(builder); builder.Entity(entity => { entity.Property(e => e.RealName).HasMaxLength(100); entity.Property(e => e.Phone).HasMaxLength(20); entity.HasIndex(e => e.TenantId); entity.HasIndex(e => e.Phone).IsUnique(); }); builder.Entity(entity => { entity.Property(e => e.Description).HasMaxLength(200); }); builder.Entity(entity => { entity.HasKey(e => e.Id); entity.HasIndex(e => e.ClientId).IsUnique(); entity.Property(e => e.ClientId).HasMaxLength(100); entity.Property(e => e.ClientSecret).HasMaxLength(200); entity.Property(e => e.DisplayName).HasMaxLength(100); entity.Property(e => e.ClientType).HasMaxLength(20); entity.Property(e => e.ConsentType).HasMaxLength(20); entity.Property(e => e.Status).HasMaxLength(20); }); } }