fengling-console/src/Data/ConsoleDbContext.cs
movingsam 154484d2dc
All checks were successful
Build and Push Docker / build (push) Successful in 6m44s
refactor(gateway): adapt to Platform 1.0.12 entity changes
- Remove IInstanceStore DI registration (replaced by IClusterStore)
- Remove GwTenant and GwServiceInstance from ConsoleDbContext config
- Update GatewayService to use Match.Path instead of PathPattern
- Cast RouteStatus enum to int for Status field
- Add 04-SUMMARY.md documentation

BREAKING CHANGE: Gateway entity API changes in Platform 1.0.12
2026-03-04 13:00:11 +08:00

68 lines
2.3 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using Fengling.Platform.Domain.AggregatesModel.GatewayAggregate;
using Fengling.Platform.Domain.AggregatesModel.RoleAggregate;
using Fengling.Platform.Domain.AggregatesModel.TenantAggregate;
using Fengling.Platform.Domain.AggregatesModel.UserAggregate;
using Fengling.Platform.Infrastructure;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace Fengling.Console.Data;
/// <summary>
/// Console 项目的 DbContext继承 PlatformDbContext 并配置表命名规范
/// PostgreSQL 命名规范:小写字母 + 下划线,模块前缀
/// </summary>
public class ConsoleDbContext : PlatformDbContext
{
public ConsoleDbContext(DbContextOptions<ConsoleDbContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
// ========== Gateway 模块 ==========
modelBuilder.Entity<GwTenantRoute>(entity =>
{
entity.ToTable("gw_tenant_routes");
});
// ========== Tenant 模块 ==========
modelBuilder.Entity<Tenant>(entity =>
{
entity.ToTable("sys_tenants");
});
// ========== Audit 模块 ==========
modelBuilder.Entity<AccessLog>(entity =>
{
entity.ToTable("sys_access_logs");
});
modelBuilder.Entity<AuditLog>(entity =>
{
entity.ToTable("sys_audit_logs");
});
// ========== Identity 模块 ==========
modelBuilder.Entity<ApplicationUser>(entity =>
{
entity.ToTable("idn_users");
});
modelBuilder.Entity<ApplicationRole>(entity =>
{
entity.ToTable("idn_roles");
});
// Identity tables - custom names
modelBuilder.Entity<IdentityUserClaim<long>>(entity => entity.ToTable("idn_user_claims"));
modelBuilder.Entity<IdentityRoleClaim<long>>(entity => entity.ToTable("idn_role_claims"));
modelBuilder.Entity<IdentityUserLogin<long>>(entity => entity.ToTable("idn_user_logins"));
modelBuilder.Entity<IdentityUserToken<long>>(entity => entity.ToTable("idn_user_tokens"));
modelBuilder.Entity<IdentityUserRole<long>>(entity => entity.ToTable("idn_user_roles"));
}
}