HubConnectionRepository.cs 874 B

12345678910111213141516171819202122232425262728293031
  1. using Microsoft.EntityFrameworkCore;
  2. using MTWorkHR.Core.Entities;
  3. using MTWorkHR.Core.IDto;
  4. using MTWorkHR.Infrastructure.Entities;
  5. using MTWorkHR.Infrastructure.DBContext;
  6. using MTWorkHR.Core.IRepositories;
  7. namespace MTWorkHR.Infrastructure.Repositories
  8. {
  9. public class HubConnectionRepository : Repository<HubConnection>, IHubConnectionRepository
  10. {
  11. private readonly DbSet<HubConnection> dbSet;
  12. public HubConnectionRepository(HRDataContext context) : base(context)
  13. {
  14. dbSet = context.Set<HubConnection>();
  15. }
  16. public async Task<Tuple<IQueryable<HubConnection>, int>> GetAllAsync(string connectionId)
  17. {
  18. var query = dbSet.AsQueryable();
  19. var total = await query.CountAsync();
  20. return new Tuple<IQueryable<HubConnection>, int>(query, total);
  21. }
  22. }
  23. }