using ASC.Common; using ASC.Core.Common.EF.Model; using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; namespace ASC.Core.Common.EF.Context { public class MySqlAccountLinkContext : AccountLinkContext { } public class PostgreSqlAccountLinkContext : AccountLinkContext { } public class AccountLinkContext : BaseDbContext { public DbSet AccountLinks { get; set; } protected override Dictionary> ProviderContext { get { return new Dictionary>() { { Provider.MySql, () => new MySqlAccountLinkContext() } , { Provider.Postrge, () => new PostgreSqlAccountLinkContext() } , }; } } protected override void OnModelCreating(ModelBuilder modelBuilder) { ModelBuilderWrapper .From(modelBuilder, Provider) .AddAccountLinks(); } } public static class AccountLinkContextExtension { public static DIHelper AddAccountLinkContextService(this DIHelper services) { return services.AddDbContextManagerService(); } } }