2022-02-09 18:49:52 +00:00
|
|
|
|
namespace ASC.Data.Backup.EF.Context;
|
|
|
|
|
|
|
|
|
|
public class BackupsContext : BaseDbContext
|
2020-05-28 13:28:51 +00:00
|
|
|
|
{
|
2022-02-09 18:49:52 +00:00
|
|
|
|
public DbSet<BackupRecord> Backups { get; set; }
|
|
|
|
|
public DbSet<BackupSchedule> Schedules { get; set; }
|
|
|
|
|
public DbSet<DbTenant> Tenants { get; set; }
|
2022-02-09 18:33:50 +00:00
|
|
|
|
|
2022-02-09 18:49:52 +00:00
|
|
|
|
public BackupsContext() { }
|
2022-02-09 18:33:50 +00:00
|
|
|
|
|
2022-02-09 18:49:52 +00:00
|
|
|
|
public BackupsContext(DbContextOptions<BackupsContext> options)
|
|
|
|
|
: base(options) { }
|
2021-08-31 09:40:28 +00:00
|
|
|
|
|
2022-02-09 18:49:52 +00:00
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
ModelBuilderWrapper
|
|
|
|
|
.From(modelBuilder, Provider)
|
|
|
|
|
.AddDbTenant();
|
2020-05-28 13:28:51 +00:00
|
|
|
|
}
|
2022-02-09 18:49:52 +00:00
|
|
|
|
}
|
2020-05-28 13:28:51 +00:00
|
|
|
|
|
2022-02-09 18:49:52 +00:00
|
|
|
|
public static class BackupsContextExtension
|
|
|
|
|
{
|
|
|
|
|
public static DIHelper AddBackupsContext(this DIHelper services)
|
2020-05-28 13:28:51 +00:00
|
|
|
|
{
|
2022-02-09 18:49:52 +00:00
|
|
|
|
return services.AddDbContextManagerService<BackupsContext>();
|
2020-05-28 13:28:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|