fengling-platform/Fengling.Platform.Infrastructure/Configurations/TenantConfiguration.cs
movingsam a17dc9c419 refactor(platform): migrate Tenant to anemia model, use Manager pattern
- Convert Tenant to anemia model with long Id (no strong-typed ID)
- Add ApplicationUser, ApplicationRole to Platform.Domain (inherit Identity)
- Add TenantInfo value object for user-tenant redundancy
- Implement TenantManager/TenantStore in Platform.Infrastructure
- Update PlatformDbContext to inherit IdentityDbContext
- Migrate AuthService and Console to use Platform entities
- Remove old TenantRepository (replaced by TenantManager)
- Update AGENTS.md documentation
2026-02-21 13:22:08 +08:00

45 lines
1.2 KiB
C#

namespace Fengling.Platform.Infrastructure.Configurations;
using Fengling.Platform.Domain.AggregatesModel.TenantAggregate;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class TenantConfiguration : IEntityTypeConfiguration<Tenant>
{
public void Configure(EntityTypeBuilder<Tenant> builder)
{
builder.ToTable("Platform_Tenants");
builder.HasKey(t => t.Id);
builder.Property(t => t.Id).ValueGeneratedOnAdd();
builder.Property(t => t.TenantCode)
.IsRequired()
.HasMaxLength(50);
builder.Property(t => t.Name)
.IsRequired()
.HasMaxLength(100);
builder.Property(t => t.ContactName)
.IsRequired()
.HasMaxLength(50);
builder.Property(t => t.ContactEmail)
.IsRequired()
.HasMaxLength(100);
builder.Property(t => t.ContactPhone)
.HasMaxLength(20);
builder.Property(t => t.Description)
.HasMaxLength(500);
builder.Property(t => t.Status)
.HasConversion<int>();
builder.HasIndex(t => t.TenantCode).IsUnique();
builder.HasIndex(t => t.Status);
}
}