fengling-console/EntityConfigurations/TenantEntityTypeConfiguration.cs
movingsam 0d64b61169 refactor(console): migrate tenant management to TenantManager pattern
- Replace TenantRepository with TenantManager (ASP.NET Identity style)
- Change TenantId from long to int (auto-increment)
- Add TenantStore with CRUD operations
- Update TenantService, UserService, RoleService to use TenantManager
- Add Tenant entity with TenantStatus enum
- Update DTOs and controllers for int tenant IDs
2026-02-19 21:43:24 +08:00

37 lines
1.0 KiB
C#

namespace Fengling.Console.EntityConfigurations;
using Fengling.Console.Models.Entities;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
public class TenantEntityTypeConfiguration : IEntityTypeConfiguration<Tenant>
{
public void Configure(EntityTypeBuilder<Tenant> 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);
}
}