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);