Files
DbFirst/DbFirst.Application/Catalogs/Queries/GetAllCatalogsHandler.cs
OlgunR 17fdb6ed51 Move repository interfaces to Application layer
Refactored IRepository<T> and ICatalogRepository to reside in the DbFirst.Application layer instead of Domain. Updated namespaces, using statements, and all references in services and handlers. Adjusted csproj dependencies to reflect the new structure. Updated comments to clarify Clean Architecture rationale and improved separation of concerns.
2026-01-19 16:42:48 +01:00

24 lines
724 B
C#

using AutoMapper;
using DbFirst.Application.Repositories;
using MediatR;
namespace DbFirst.Application.Catalogs.Queries;
public class GetAllCatalogsHandler : IRequestHandler<GetAllCatalogsQuery, List<CatalogReadDto>>
{
private readonly ICatalogRepository _repository;
private readonly IMapper _mapper;
public GetAllCatalogsHandler(ICatalogRepository repository, IMapper mapper)
{
_repository = repository;
_mapper = mapper;
}
public async Task<List<CatalogReadDto>> Handle(GetAllCatalogsQuery request, CancellationToken cancellationToken)
{
var items = await _repository.GetAllAsync(cancellationToken);
return _mapper.Map<List<CatalogReadDto>>(items);
}
}