public EmailSender( ILogger <EmailSender> logger, IOptions <GlobalSettings> globalSettings, IEventAggregator eventAggregator, INotificationHandler <SendEmailNotification> handler1, INotificationAsyncHandler <SendEmailNotification> handler2) { _logger = logger; _eventAggregator = eventAggregator; _globalSettings = globalSettings.Value; _notificationHandlerRegistered = handler1 is not null || handler2 is not null; }
public EmailSender( ILogger <EmailSender> logger, IOptionsMonitor <GlobalSettings> globalSettings, IEventAggregator eventAggregator, INotificationHandler <SendEmailNotification>?handler1, INotificationAsyncHandler <SendEmailNotification>?handler2) { _logger = logger; _eventAggregator = eventAggregator; _globalSettings = globalSettings.CurrentValue; _notificationHandlerRegistered = handler1 is not null || handler2 is not null; globalSettings.OnChange(x => _globalSettings = x); }