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-02-17 08:58:14 +00:00
|
|
|
|
using ASC.Core.Common.EF.Model.Mail;
|
2019-12-13 11:37:58 +00:00
|
|
|
|
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
|
|
|
|
|
namespace ASC.Core.Common.EF.Context
|
|
|
|
|
{
|
2020-10-05 09:27:15 +00:00
|
|
|
|
public class MailDbContext : BaseDbContext
|
2019-12-13 11:37:58 +00:00
|
|
|
|
{
|
|
|
|
|
public DbSet<MailboxServer> MailboxServer { get; set; }
|
|
|
|
|
public DbSet<ServerServer> ServerServer { get; set; }
|
|
|
|
|
public DbSet<MailboxProvider> MailboxProvider { get; set; }
|
|
|
|
|
public DbSet<Mailbox> Mailbox { get; set; }
|
|
|
|
|
public DbSet<ApiKeys> ApiKeys { get; set; }
|
|
|
|
|
public DbSet<GreyListingWhiteList> GreyListingWhiteList { get; set; }
|
|
|
|
|
|
|
|
|
|
public MailDbContext() { }
|
2020-08-21 02:34:37 +00:00
|
|
|
|
public MailDbContext(DbContextOptions options) : base(options)
|
2019-12-13 11:37:58 +00:00
|
|
|
|
{
|
2020-10-05 09:27:15 +00:00
|
|
|
|
//Database.EnsureCreated();
|
2019-12-13 11:37:58 +00:00
|
|
|
|
}
|
2020-08-21 02:34:37 +00:00
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
2020-09-06 22:49:03 +00:00
|
|
|
|
ModelBuilderWrapper
|
|
|
|
|
.From(modelBuilder, Provider)
|
|
|
|
|
.AddMailbox()
|
|
|
|
|
.AddMailboxProvider()
|
2020-10-05 10:02:28 +00:00
|
|
|
|
.AddServerServer();
|
2020-08-21 02:34:37 +00:00
|
|
|
|
}
|
2019-12-13 11:37:58 +00:00
|
|
|
|
}
|
2019-12-16 14:55:59 +00:00
|
|
|
|
public static class MailDbExtension
|
|
|
|
|
{
|
2020-02-17 08:58:14 +00:00
|
|
|
|
public static DIHelper AddMailDbContextService(this DIHelper services)
|
2019-12-16 14:55:59 +00:00
|
|
|
|
{
|
|
|
|
|
return services.AddDbContextManagerService<MailDbContext>();
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-12-13 11:37:58 +00:00
|
|
|
|
}
|