public LoggingRuleManager(LoggingRuleRepository loggingRuleRepository, IConfiguration configuration, ILoggerFactory loggerFactory, DiagnosticSource diagnosticSource, HttpClient httpClient = null) { _loggingRuleRepository = loggingRuleRepository; _configuration = configuration; _loggerFactory = loggerFactory; _diagnosticSource = diagnosticSource; _httpClient = httpClient; _loggingRuleRepository.AfterInsert = rule => _rules.Add(rule); _loggingRuleRepository.AfterUpdate = rule => _rules = new ConcurrentBag <LoggingRule>(_rules.Where(x => x.Id != rule.Id)); _loggingRuleRepository.AfterDelete = rule => _rules = new ConcurrentBag <LoggingRule>(_rules.Where(x => x.Id != rule.Id)); }
public LoggingItemRepository(string assembly, ConnectionOptions connectionOptions, ILoggerFactory loggerFactory, DiagnosticSource diagnosticSource, IOptions <LoggingSettings> options, IConfiguration configuration) : base(assembly, connectionOptions, loggerFactory, diagnosticSource) { AfterInsert = OnInsert; _logSettings = options.Value; _loggingAppender = PluginContainer.GetInstance <ILoggingAppender>(_logSettings.Appender, _logSettings); _loggingAppender.InitializeAppender(); var loggingRuleRepository = new LoggingRuleRepository(_logSettings.NotificationRules.ProviderAssembly, new ConnectionOptions { Provider = _logSettings.NotificationRules.ProviderType, ConnectionString = _logSettings.NotificationRules.ConnectionString }, loggerFactory, diagnosticSource); _loggingRuleManager = new LoggingRuleManager(loggingRuleRepository, configuration, loggerFactory, diagnosticSource); }