2022-01-26 10:43:08 +00:00
|
|
|
|
namespace ASC.Core.Common.EF.Context
|
2019-12-04 11:40:42 +00:00
|
|
|
|
{
|
2020-10-06 11:38:15 +00:00
|
|
|
|
public class MySqlAccountLinkContext : AccountLinkContext { }
|
|
|
|
|
public class PostgreSqlAccountLinkContext : AccountLinkContext { }
|
2020-10-05 09:27:15 +00:00
|
|
|
|
public class AccountLinkContext : BaseDbContext
|
2019-12-04 11:40:42 +00:00
|
|
|
|
{
|
|
|
|
|
public DbSet<AccountLinks> AccountLinks { get; set; }
|
|
|
|
|
|
2020-10-06 11:38:15 +00:00
|
|
|
|
protected override Dictionary<Provider, Func<BaseDbContext>> ProviderContext
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return new Dictionary<Provider, Func<BaseDbContext>>()
|
|
|
|
|
{
|
|
|
|
|
{ Provider.MySql, () => new MySqlAccountLinkContext() } ,
|
2021-10-12 10:23:20 +00:00
|
|
|
|
{ Provider.PostgreSql, () => new PostgreSqlAccountLinkContext() } ,
|
2020-10-06 11:38:15 +00:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-12-04 11:40:42 +00:00
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
2020-10-12 19:39:23 +00:00
|
|
|
|
ModelBuilderWrapper
|
2020-09-06 22:49:03 +00:00
|
|
|
|
.From(modelBuilder, Provider)
|
2020-10-05 10:02:28 +00:00
|
|
|
|
.AddAccountLinks();
|
2019-12-04 11:40:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static class AccountLinkContextExtension
|
|
|
|
|
{
|
2020-02-17 08:58:14 +00:00
|
|
|
|
public static DIHelper AddAccountLinkContextService(this DIHelper services)
|
2019-12-04 11:40:42 +00:00
|
|
|
|
{
|
2019-12-10 15:06:51 +00:00
|
|
|
|
return services.AddDbContextManagerService<AccountLinkContext>();
|
2019-12-04 11:40:42 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|