Example #1
0
 public void Handle(DateTime lastTime, DateTime currentTime, DateTime nextTime)
 {
     _logger.LogInformation((int)LogEvent.分支切换, $"开始分支切换 {lastTime}->{currentTime}");
     _branchBlock.Close();
     _logger.LogInformation((int)LogEvent.分支切换, "保存当前数据");
     using (IServiceScope serviceScope = _serviceProvider.CreateScope())
     {
         string tableName = BranchDbConvert.GetTableName(lastTime);
         ChangeDatabase(serviceScope.ServiceProvider, tableName);
     }
     _branchBlock.SwitchBranch(currentTime, nextTime);
     _logger.LogInformation((int)LogEvent.分支切换, $"切换完成分支 {currentTime}->{nextTime}");
 }