| | |
| | | |
| | | public Task StartAsync(CancellationToken cancellationToken) |
| | | { |
| | | string connStr = AppSettings.GetValue("WMSConnectionStrings"); |
| | | if (string.IsNullOrEmpty(connStr)) |
| | | try |
| | | { |
| | | throw new Exception("WMSè¿æ¥å符串é误"); |
| | | string connStr = AppSettings.GetValue("WMSConnectionStrings"); |
| | | if (string.IsNullOrEmpty(connStr)) |
| | | { |
| | | throw new Exception("WMSè¿æ¥å符串é误"); |
| | | } |
| | | SqlSugarClient sugarClient = new(new ConnectionConfig() |
| | | { |
| | | ConnectionString = connStr, |
| | | IsAutoCloseConnection = true, |
| | | DbType = DbType.SqlServer |
| | | }); |
| | | |
| | | //List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); |
| | | |
| | | //_dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); |
| | | |
| | | //_dbContext.Db.Insertable(warehouses).ExecuteCommand(); |
| | | |
| | | List<Dt_ApiInfo> apiInfos = _dbContext.Db.Queryable<Dt_ApiInfo>().ToList(); |
| | | |
| | | _cacheService.AddOrUpdate(nameof(apiInfos), apiInfos); |
| | | } |
| | | SqlSugarClient sugarClient = new(new ConnectionConfig() |
| | | catch (Exception ex) |
| | | { |
| | | ConnectionString = connStr, |
| | | IsAutoCloseConnection = true, |
| | | DbType = DbType.SqlServer |
| | | }); |
| | | |
| | | List<Dt_Warehouse> warehouses = sugarClient.Queryable<Dt_Warehouse>().ToList(); |
| | | |
| | | _dbContext.Db.Deleteable<Dt_Warehouse>().ExecuteCommand(); |
| | | |
| | | _dbContext.Db.Insertable(warehouses).ExecuteCommand(); |
| | | |
| | | List<Dt_ApiInfo> apiInfos = _dbContext.Db.Queryable<Dt_ApiInfo>().ToList(); |
| | | |
| | | _cacheService.AddOrUpdate(nameof(apiInfos), apiInfos); |
| | | |
| | | Console.WriteLine(ex.ToString()); |
| | | } |
| | | return Task.CompletedTask; |
| | | } |
| | | |
| | | public Task StopAsync(CancellationToken cancellationToken) |
| | | { |
| | | throw new NotImplementedException(); |
| | | return Task.CompletedTask; |
| | | } |
| | | } |
| | | } |