Enhance query performance by applying AsSplitQuery to multiple handlers and loaders for Channels and ScheduleTemplates, improving efficiency in data retrieval and reducing unnecessary data duplication in queries.
ci / build-backend (push) Successful in 1m26s
ci / build-frontend (push) Successful in 49s
ci / tests (push) Successful in 4m18s
ci / sonar (push) Failing after 2m31s

This commit is contained in:
Leonid Pershin
2026-07-26 21:50:01 +03:00
parent b52080e026
commit c4c93cff02
14 changed files with 25 additions and 0 deletions
@@ -25,6 +25,7 @@ public sealed class CopyTemplateCommandHandler(IAppDbContext dbContext)
.ScheduleTemplates.AsNoTracking()
.Include(t => t.Layers)
.ThenInclude(l => l.Slots)
.AsSplitQuery()
.FirstOrDefaultAsync(t => t.ChannelId == command.SourceChannelId, cancellationToken);
if (source is null)
return Result.Failure<CopyTemplateResultDto>(ChannelErrors.TemplateNotFound);