54 lines
1.6 KiB
C#
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; }
|
||
|
|
}
|
||
|
|
}
|