move DbTriggerParams to Infrastructure layer.
- createConfig for flexable configuration
This commit is contained in:
@@ -13,6 +13,7 @@ using DigitalData.UserManager.Infrastructure.Contracts;
|
||||
using DigitalData.Core.Client;
|
||||
using EnvelopeGenerator.Application.Common.Configurations;
|
||||
#elif NETFRAMEWORK
|
||||
using System.Linq;
|
||||
#endif
|
||||
|
||||
namespace EnvelopeGenerator.Infrastructure
|
||||
@@ -35,7 +36,7 @@ public abstract class EGDbContextBase : DbContext
|
||||
, IUserManagerDbContext, IMailDbContext
|
||||
#endif
|
||||
{
|
||||
public DbSet<Config> Configs { get; set; }
|
||||
public DbSet<Domain.Entities.Config> Configs { get; set; }
|
||||
|
||||
public DbSet<EnvelopeReceiver> EnvelopeReceivers { get; set; }
|
||||
|
||||
@@ -85,7 +86,11 @@ public abstract class EGDbContextBase : DbContext
|
||||
|
||||
public bool IsMigration { get; set; } = false;
|
||||
|
||||
public EGDbContextBase(DbContextOptions options, IOptions<DbTriggerParams> triggerParamOptions, ILogger? logger = null) : base(options)
|
||||
public EGDbContextBase(DbContextOptions options, IOptions<DbTriggerParams> triggerParamOptions, ILogger
|
||||
#if NET
|
||||
?
|
||||
#endif
|
||||
logger = null) : base(options)
|
||||
{
|
||||
_triggers = triggerParamOptions.Value;
|
||||
_logger = logger;
|
||||
@@ -213,7 +218,9 @@ public abstract class EGDbContextBase : DbContext
|
||||
.SelectMany(t => t.Value)
|
||||
.ForEach(tName =>
|
||||
{
|
||||
#if NET
|
||||
modelBuilder.Entity<T>().ToTable(tb => tb.HasTrigger(tName));
|
||||
#endif
|
||||
_logger?.LogInformation("Trigger '{triggerName}' has been added to the '{entityName}' entity.", tName, typeof(T).Name);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user