using SqlSugar; using WIDESEAWCS_Core.Helper; using WIDESEAWCS_DTO.BasicInfo; namespace WIDESEAWCS_Server.HostedService { public class WarehouseHostedService : IHostedService { public Task StartAsync(CancellationToken cancellationToken) { string connStr = AppSettings.GetValue("WMSConnectionStrings"); if (string.IsNullOrEmpty(connStr)) { throw new Exception("WMS连接字符串错误"); } SqlSugarClient sugarClient = new SqlSugarClient(new ConnectionConfig() { ConnectionString = connStr, IsAutoCloseConnection = true, DbType = DbType.SqlServer }); List warehouses = sugarClient.Queryable().ToList(); return Task.CompletedTask; } public Task StopAsync(CancellationToken cancellationToken) { throw new NotImplementedException(); } } }