using System; using System.Collections.Generic; using ASC.Common; using ASC.Core.Common.EF.Model; using Microsoft.EntityFrameworkCore; namespace ASC.Core.Common.EF.Context { public class MySqlFilesDbContext : FilesDbContext { } public class PostgreSqlFilesDbContext : FilesDbContext { } public class FilesDbContext : BaseDbContext { public DbSet FilesConverts { get; set; } protected override Dictionary> ProviderContext { get { return new Dictionary>() { { Provider.MySql, () => new MySqlFilesDbContext() } , { Provider.Postgre, () => new PostgreSqlFilesDbContext() } , }; } } protected override void OnModelCreating(ModelBuilder modelBuilder) { ModelBuilderWrapper .From(modelBuilder, Provider) .AddFilesConverts(); } } public static class FilesDbExtension { public static DIHelper AddFilesDbContextService(this DIHelper services) { return services.AddDbContextManagerService(); } } }