From 9f18e82749f2d39da54b2764e99e870e517dba12 Mon Sep 17 00:00:00 2001 From: NazarovMikhail Date: Wed, 10 Jan 2024 14:15:51 +0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Monq.Core.Paging.Tests/PagingExtensionsTests.cs | 2 +- src/Monq.Core.Paging/Extensions/QueryableExtensions.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Monq.Core.Paging.Tests/PagingExtensionsTests.cs b/src/Monq.Core.Paging.Tests/PagingExtensionsTests.cs index edb99be..a3daf28 100644 --- a/src/Monq.Core.Paging.Tests/PagingExtensionsTests.cs +++ b/src/Monq.Core.Paging.Tests/PagingExtensionsTests.cs @@ -441,7 +441,7 @@ public async Task ShouldProperlySearchDataTablesRecordsInListByStringField() Assert.Equal(3, result.Data.First().Id); } - [Fact(DisplayName = "Проверка фильтрации элементов по полю paging.Search по полю типа Guid")] + [Fact(DisplayName = "Checking a filtration by property paging.Search (property type is Guid).")] public void ShouldProperlySearchRecordsInListByGuidField() { var guidValue = new Guid(string.Format("{0:00000000-0000-0000-0000-000000000000}", 7)); diff --git a/src/Monq.Core.Paging/Extensions/QueryableExtensions.cs b/src/Monq.Core.Paging/Extensions/QueryableExtensions.cs index 7ad6274..39d2ab5 100644 --- a/src/Monq.Core.Paging/Extensions/QueryableExtensions.cs +++ b/src/Monq.Core.Paging/Extensions/QueryableExtensions.cs @@ -56,6 +56,9 @@ public static IQueryable OrderByProperty(this IQueryable p.Property.PropertyType == typeof(string)).ToList(); + + if (!props.Any()) + return null; var parameter = Expression.Parameter(typeof(TSource), "t"); var methodContains = typeof(string).GetMethod(nameof(string.Contains), new[] { typeof(string) });