41 lines
1.1 KiB
C#
41 lines
1.1 KiB
C#
using ASC.Common;
|
|
using ASC.Core.Common.EF.Model;
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace ASC.Core.Common.EF.Context
|
|
{
|
|
public partial class NotifyDbContext : BaseDbContext
|
|
{
|
|
public DbSet<NotifyInfo> NotifyInfo { get; set; }
|
|
public DbSet<NotifyQueue> NotifyQueue { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
if (baseName == "default")
|
|
{
|
|
modelBuilder
|
|
.MySqlAddNotifyInfo()
|
|
.MySqlAddNotifyQueue();
|
|
}
|
|
else
|
|
{
|
|
modelBuilder
|
|
.PgSqlAddNotifyInfo()
|
|
.PgSqlAddNotifyQueue(); ;
|
|
}
|
|
OnModelCreatingPartial(modelBuilder);
|
|
}
|
|
|
|
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
|
}
|
|
|
|
public static class NotifyDbExtension
|
|
{
|
|
public static DIHelper AddNotifyDbContext(this DIHelper services)
|
|
{
|
|
return services.AddDbContextManagerService<NotifyDbContext>();
|
|
}
|
|
}
|
|
}
|