public static void TenantBuilderSetup <TDbContext, TBuilder, TExtension>(this RelationalDbContextOptionsBuilder <TBuilder, TExtension> builder, IServiceProvider serviceProvider, TenantSettings <TDbContext> settings, TenantInfo tenant) where TDbContext : DbContext, ITenantDbContext where TBuilder : RelationalDbContextOptionsBuilder <TBuilder, TExtension> where TExtension : RelationalOptionsExtension, new() { if (settings.ConnectionType == ConnectionResolverType.ByTable) { builder.MigrationsHistoryTable($"{tenant.Name}__EFMigrationsHistory"); } if (settings.ConnectionType == ConnectionResolverType.BySchema) { builder.MigrationsHistoryTable("__EFMigrationHistory", $"{(settings.SchemaFunc?.Invoke(tenant) ?? tenant.Name)}"); } }
private void ConfigureDbContext <TBuilder, TExtension>(RelationalDbContextOptionsBuilder <TBuilder, TExtension> options) where TBuilder : RelationalDbContextOptionsBuilder <TBuilder, TExtension> where TExtension : RelationalOptionsExtension, new() { options.MigrationsAssembly("Bechtle.A365.ConfigService.Migrations"); options.MigrationsHistoryTable("__EFMigrationsHistory", SnapshotContext.Schema); }