public DefaultController(ISqlSugarFactory sqlSugarFactory, IDataLogService logService) { _db = (MySqlSugarClient)sqlSugarFactory.CreateClient("LogsConnection");//Database=DGCN.HXCloud.ID4 Localhost LogsConnection _logService = logService; //1、解决方案:重写SqlSugarClient客户端 (1)使用方便(2)要在注入的时候修改 //2、解决方案:扩展SqlSugarClient客户端 (1)注入不需要修改(2)但所有方法使用的时候需要执行EnableDiffLogEvent方法 //3、解决方案:使用OnLogExecuted (1)方法执行前后的数据获取不到即使修改也很难 }
public EnvironmentController(IConfiguration configuration, IDataLogService dataLogService, IOpenWeatherMapService openWeatherMapService) { _dataLogService = dataLogService; _openWeatherMapService = openWeatherMapService; _configuration = configuration; }