mh_frame_sps/APT.Infrastructure.EF/TenantSettings.cs
2026-04-07 13:47:52 +08:00

54 lines
1.6 KiB
C#

using System;
using APT.Infrastructure.Api;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
namespace APT.Infrastructure.EF
{
public abstract class TenantSettings
{
public string Key { get; set; }
public ConnectionResolverType ConnectionType { get; set; }
public DbIntegrationType DbType { get; set; }
public Func<IConnectionGenerator> ConnectionGenerator { get; set; }
public string ConnectionName { get; set; }
public string ConnectionPrefix { get; set; }
public Action<DbContextOptionsBuilder> DbContextOptionAction { get; set; }
public Func<TenantInfo, string, string> TableNameFunc { get; set; }
public Func<TenantInfo, string> SchemaFunc { get; set; }
public Action<IServiceProvider, string, DbContextOptionsBuilder, TenantSettings> DbContextSetup { get; set; }
}
public class TenantSettings<TDbContext>
where TDbContext : DbContext
{
public string Key { get; set; }
public ConnectionResolverType ConnectionType { get; set; }
public DbIntegrationType DbType { get; set; }
public Func<IConnectionGenerator> ConnectionGenerator { get; set; }
public string ConnectionName { get; set; }
public string ConnectionPrefix { get; set; }
public Action<DbContextOptionsBuilder> DbContextOptionAction { get; set; }
public Func<TenantInfo, string, string> TableNameFunc { get; set; }
public Func<TenantInfo, string> SchemaFunc { get; set; }
public Action<IServiceProvider, string, DbContextOptionsBuilder> DbContextSetup { get; set; }
}
}