using SnapshotWinFormsApp.Application.Dtos; using SnapshotWinFormsApp.Repository.Interfaces; using SqlSugar; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SnapshotWinFormsApp.Repository; public class SelectRepository : ISelectRepository where T : DataTransmission.Entity.Entity, new() { private readonly SqlSugarClient _db; public SelectRepository(CreateInstanceInDto inDto) { var context = inDto.DbSqlServer; _db = context.DbItems.GetValueOrDefault(inDto.Key + "PGSQLDB"); } public IList GetAll() { return _db.Queryable().ToList(); } public async Task> GetAllAsync(CancellationToken token) { return await _db.Queryable().ToListAsync(token); } public T GetById(string id) { return _db.Queryable().Where(m => m.Id == id).First(); } public ISugarQueryable Queryable() { return _db.Queryable(); } }