namespace Fengling.Console.EntityConfigurations; using Fengling.Console.Models.Entities; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Metadata.Builders; public class TenantEntityTypeConfiguration : IEntityTypeConfiguration { public void Configure(EntityTypeBuilder builder) { builder.ToTable("Tenants"); builder.HasKey(x => x.Id); builder.Property(x => x.Id) .ValueGeneratedOnAdd(); builder.Property(x => x.TenantCode) .IsRequired() .HasMaxLength(50); builder.Property(x => x.Name) .IsRequired() .HasMaxLength(100); builder.Property(x => x.ContactName) .IsRequired() .HasMaxLength(50); builder.Property(x => x.ContactEmail) .IsRequired() .HasMaxLength(100); builder.HasIndex(x => x.TenantCode).IsUnique(); builder.HasIndex(x => x.Name); } }