2019-12-17 13:01:59 +00:00
|
|
|
|
|
2020-02-17 08:58:14 +00:00
|
|
|
|
using ASC.Common;
|
2020-09-06 22:49:03 +00:00
|
|
|
|
using ASC.Core.Common.EF.Model;
|
2020-10-05 09:27:15 +00:00
|
|
|
|
|
2019-12-17 13:01:59 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
2019-11-29 12:26:53 +00:00
|
|
|
|
|
|
|
|
|
namespace ASC.Core.Common.EF
|
|
|
|
|
{
|
2020-10-05 09:27:15 +00:00
|
|
|
|
public class CoreDbContext : BaseDbContext
|
2019-11-29 12:26:53 +00:00
|
|
|
|
{
|
2019-12-02 12:22:40 +00:00
|
|
|
|
public DbSet<DbTariff> Tariffs { get; set; }
|
|
|
|
|
public DbSet<DbButton> Buttons { get; set; }
|
2020-10-05 09:27:15 +00:00
|
|
|
|
public DbSet<Acl> Acl { get; set; }
|
2019-12-02 09:12:16 +00:00
|
|
|
|
public DbSet<DbQuota> Quotas { get; set; }
|
|
|
|
|
public DbSet<DbQuotaRow> QuotaRows { get; set; }
|
2019-11-29 12:26:53 +00:00
|
|
|
|
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
2020-09-06 22:49:03 +00:00
|
|
|
|
ModelBuilderWrapper
|
|
|
|
|
.From(modelBuilder, Provider)
|
|
|
|
|
.AddAcl()
|
|
|
|
|
.AddDbButton()
|
|
|
|
|
.AddDbQuotaRow()
|
|
|
|
|
.AddDbQuota()
|
|
|
|
|
.AddDbTariff()
|
|
|
|
|
.Finish();
|
2019-11-29 12:26:53 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-29 13:47:05 +00:00
|
|
|
|
|
2019-12-17 13:01:59 +00:00
|
|
|
|
|
2019-11-29 13:47:05 +00:00
|
|
|
|
public static class CoreDbExtension
|
|
|
|
|
{
|
2020-02-17 08:58:14 +00:00
|
|
|
|
public static DIHelper AddCoreDbContextService(this DIHelper services)
|
2019-11-29 13:47:05 +00:00
|
|
|
|
{
|
2019-12-10 15:06:51 +00:00
|
|
|
|
return services.AddDbContextManagerService<CoreDbContext>();
|
2019-11-29 13:47:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2019-11-29 12:26:53 +00:00
|
|
|
|
}
|