From f647afcd53056796c4211a15818e294ecc56ae1d Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Fri, 6 Dec 2024 17:06:16 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B5=D0=B7=D1=83=D0=BB=D1=8C=D1=82=D0=B0=D1=82?= =?UTF-8?q?=D0=B0=D0=BC=20=D1=82=D0=B5=D1=81=D1=82=D0=B8=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Persistence.Repository/QueryBuilders.cs | 8 ++++++-- .../Repositories/ChangeLogRepository.cs | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Persistence.Repository/QueryBuilders.cs b/Persistence.Repository/QueryBuilders.cs index 23f5462..9ed98e5 100644 --- a/Persistence.Repository/QueryBuilders.cs +++ b/Persistence.Repository/QueryBuilders.cs @@ -10,7 +10,7 @@ namespace Persistence.Repository; /// public static class QueryBuilders { - public static void Apply(this IQueryable query, SectionPartRequest request) + public static IQueryable Apply(this IQueryable query, SectionPartRequest request) where TEntity : class, IWithSectionPart { if (request.IdSection.HasValue) @@ -25,9 +25,11 @@ public static class QueryBuilders { query = query.Where(e => e.DepthEnd <= request.DepthEnd); } + + return query; } - public static void Apply(this IQueryable query,DateTimeOffset momentUtc) + public static IQueryable Apply(this IQueryable query,DateTimeOffset momentUtc) where TEntity : class, IChangeLog { momentUtc = momentUtc.ToUniversalTime(); @@ -35,6 +37,8 @@ public static class QueryBuilders query = query .Where(e => e.Creation <= momentUtc) .Where(e => e.Obsolete == null || e.Obsolete >= momentUtc); + + return query; } diff --git a/Persistence.Repository/Repositories/ChangeLogRepository.cs b/Persistence.Repository/Repositories/ChangeLogRepository.cs index 53eba23..4b5d901 100644 --- a/Persistence.Repository/Repositories/ChangeLogRepository.cs +++ b/Persistence.Repository/Repositories/ChangeLogRepository.cs @@ -139,8 +139,8 @@ public class ChangeLogRepository : IChangeLogRepository CancellationToken token) { var query = CreateQuery(idDiscriminator); - query.Apply(momentUtc); - query.Apply(filterRequest); + query = query.Apply(momentUtc); + query = query.Apply(filterRequest); var result = await query.ApplyPagination(paginationRequest, Convert, token);