@@ -12,19 +12,22 @@ namespace EntityFrameworkCore.Triggered
1212{
1313 public class TriggerService : ITriggerService , IResettableService
1414 {
15+
1516 readonly ITriggerDiscoveryService _triggerDiscoveryService ;
1617 readonly ICascadeStrategy _cascadingStrategy ;
1718 readonly ILoggerFactory _loggerFactory ;
18- readonly TriggerOptions _options ;
19+ readonly TriggerConfiguration _defaultConfiguration ;
1920
2021 ITriggerSession ? _currentTriggerSession ;
2122
22- public TriggerService ( ITriggerDiscoveryService triggerDiscoveryService , ICascadeStrategy cascadingStrategy , ILoggerFactory loggerFactory , IOptionsSnapshot < TriggerOptions > triggerOptionsSnapshot )
23+ public TriggerService ( ITriggerDiscoveryService triggerDiscoveryService , ICascadeStrategy cascadingStrategy , ILoggerFactory loggerFactory , IOptions < TriggerOptions > triggerOptions )
2324 {
2425 _triggerDiscoveryService = triggerDiscoveryService ?? throw new ArgumentNullException ( nameof ( triggerDiscoveryService ) ) ;
2526 _cascadingStrategy = cascadingStrategy ?? throw new ArgumentNullException ( nameof ( cascadingStrategy ) ) ;
2627 _loggerFactory = loggerFactory ?? throw new ArgumentNullException ( nameof ( loggerFactory ) ) ;
27- _options = triggerOptionsSnapshot . Value ;
28+ _defaultConfiguration = new TriggerConfiguration ( false , triggerOptions . Value . MaxCascadeCycles ) ;
29+
30+ Configuration = _defaultConfiguration ;
2831 }
2932
3033 public ITriggerSession ? Current
@@ -33,6 +36,8 @@ public ITriggerSession? Current
3336 set => _currentTriggerSession = value ;
3437 }
3538
39+ public TriggerConfiguration Configuration { get ; set ; }
40+
3641 public ITriggerSession CreateSession ( DbContext context , IServiceProvider ? serviceProvider )
3742 {
3843 if ( context is null )
@@ -47,7 +52,7 @@ public ITriggerSession CreateSession(DbContext context, IServiceProvider? servic
4752 _triggerDiscoveryService . ServiceProvider = serviceProvider ;
4853 }
4954
50- var triggerSession = new TriggerSession ( this , _options , _triggerDiscoveryService , triggerContextTracker , _loggerFactory . CreateLogger < TriggerSession > ( ) ) ;
55+ var triggerSession = new TriggerSession ( this , Configuration , _triggerDiscoveryService , triggerContextTracker , _loggerFactory . CreateLogger < TriggerSession > ( ) ) ;
5156
5257 _currentTriggerSession = triggerSession ;
5358
@@ -61,6 +66,8 @@ public void ResetState()
6166 _currentTriggerSession . Dispose ( ) ;
6267 _currentTriggerSession = null ;
6368 }
69+
70+ Configuration = _defaultConfiguration ;
6471 }
6572
6673 public Task ResetStateAsync ( CancellationToken cancellationToken = default )
0 commit comments