Ejemplo n.º 1
0
 /// <summary>
 /// 配置文件修改触发事件
 /// </summary>
 /// <param name="options"></param>
 public void TriggerChanged(SmartSqlDbConfigOptions options)
 {
     _options = options;
     //修改数据库连接
     this.SqlMapConfig.Database = new SmartSql.Configuration.Database()
     {
         DbProvider      = _options.Database.DbProvider,
         ReadDataSources = _options.Database.Read,
         WriteDataSource = _options.Database.Write
     };
     //触发
     OnChanged?.Invoke(this, new OnChangedEventArgs
     {
         EventType    = EventType.ConfigChanged,
         SqlMapConfig = this.SqlMapConfig
     });
 }
Ejemplo n.º 2
0
 public OptionConfigLoader(SmartSqlDbConfigOptions smartSqlOptions, ILoggerFactory loggerFactory)
 {
     _options           = smartSqlOptions;
     _logger            = loggerFactory.CreateLogger <OptionConfigLoader>();
     _fileWatcherLoader = new FileWatcherLoader();
 }