using Microsoft.Extensions.Options; namespace Zxd.Domain { public class SystemConfigDomain : ISystemConfigDomain { private readonly IOptionsSnapshot _systemConfig; public SystemConfigDomain(IOptionsSnapshot systemConfig) { _systemConfig = systemConfig; } /// /// 获取配置文件 /// /// public SystemConfig GetSystemConfig() { return _systemConfig.Value; } public ClientKey GetClientKey(string clientId) { var client = _systemConfig.Value.ClientKey.FirstOrDefault(x => x.Id == clientId); if (client == null) throw new Exception("非法客户端访问"); return client; } } }