using Microsoft.Extensions.DependencyInjection; using Seyounth.Hyosung.Data.Entities; using Seyounth.Hyosung.Data.Repositories; using SqlSugar; namespace Seyounth.Hyosung.Data.Services; public class DictService : IDictService { private readonly IRepository _repository; private readonly List _cache; public DictService(IServiceProvider provider) { _repository = provider.CreateScope() .ServiceProvider.GetRequiredService>(); //_repository = provider.GetService>(); _cache = _repository.GetList(); } public async Task GetKeyAsync(string type, string name) { return _cache.FirstOrDefault(d => d.Type == type && d.Value == name)?.Value ?? ""; } public async Task> GetDictsByTypeAsync(string type) { return _cache.Where(d => d.Type == type).ToList(); } }