- Add Fengling.Platform domain and infrastructure projects - Move Tenant aggregate from AuthService/Console to Platform.Domain - Add TenantRepository and SeedData to Platform - Remove duplicate Tenant/TenantInfo models from AuthService and Console - Update controllers and services to use Platform.Domain.Tenant - Add new migrations for PlatformDbContext BREAKING CHANGE: Tenant entity now uses strongly-typed ID (TenantId)
45 lines
1.2 KiB
C#
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).UseSnowFlakeValueGenerator();
|
|
|
|
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);
|
|
}
|
|
}
|