All checks were successful
Build and Push Docker / build (push) Successful in 6m44s
- 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
68 lines
2.3 KiB
C#
68 lines
2.3 KiB
C#
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"));
|
||
}
|
||
}
|