2020-05-28 13:28:51 +00:00
|
|
|
|
using ASC.Common;
|
|
|
|
|
using ASC.Core.Common.EF;
|
|
|
|
|
using ASC.Core.Common.EF.Model;
|
|
|
|
|
using ASC.Data.Backup.EF.Model;
|
2020-08-27 14:01:37 +00:00
|
|
|
|
|
2020-05-28 13:28:51 +00:00
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace ASC.Data.Backup.EF.Context
|
|
|
|
|
{
|
|
|
|
|
public class BackupsContext : BaseDbContext
|
|
|
|
|
{
|
|
|
|
|
public DbSet<BackupRecord> Backups { get; set; }
|
2020-05-29 14:48:27 +00:00
|
|
|
|
public DbSet<BackupSchedule> Schedules { get; set; }
|
2022-01-21 13:45:50 +00:00
|
|
|
|
public DbSet<DbTenant> Tenants { get; set; }
|
2020-05-28 13:28:51 +00:00
|
|
|
|
public BackupsContext() { }
|
|
|
|
|
public BackupsContext(DbContextOptions<BackupsContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{
|
|
|
|
|
}
|
2021-08-31 09:40:28 +00:00
|
|
|
|
|
2021-08-10 08:36:07 +00:00
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
ModelBuilderWrapper
|
|
|
|
|
.From(modelBuilder, Provider)
|
2022-01-21 13:45:50 +00:00
|
|
|
|
.AddDbTenant();
|
2020-05-28 13:28:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-10 12:35:10 +00:00
|
|
|
|
public static class BackupsContextExtension
|
2020-05-28 13:28:51 +00:00
|
|
|
|
{
|
2020-06-10 12:35:10 +00:00
|
|
|
|
public static DIHelper AddBackupsContext(this DIHelper services)
|
2020-05-28 13:28:51 +00:00
|
|
|
|
{
|
|
|
|
|
return services.AddDbContextManagerService<BackupsContext>();
|
2020-06-10 12:35:10 +00:00
|
|
|
|
}
|
2020-05-28 13:28:51 +00:00
|
|
|
|
}
|
|
|
|
|
}
|