using ErsatzTV.Infrastructure.Data; using Microsoft.EntityFrameworkCore; using static ErsatzTV.Application.Filler.Mapper; namespace ErsatzTV.Application.Filler; public class GetAllFillerPresetsHandler : IRequestHandler> { private readonly IDbContextFactory _dbContextFactory; public GetAllFillerPresetsHandler(IDbContextFactory dbContextFactory) => _dbContextFactory = dbContextFactory; public async Task> Handle( GetAllFillerPresets request, CancellationToken cancellationToken) { await using TvContext dbContext = await _dbContextFactory.CreateDbContextAsync(cancellationToken); return await dbContext.FillerPresets.ToListAsync(cancellationToken) .Map(presets => presets.Map(ProjectToViewModel).ToList()); } }