From 4948fca516d905b2f3069381b069425d14ccade7 Mon Sep 17 00:00:00 2001 From: enisn Date: Wed, 24 Mar 2021 09:52:40 +0300 Subject: [PATCH] Check NullOrEmpty for sortings instead of null coalescing in TenantManagement --- .../EntityFrameworkCore/EfCoreTenantRepository.cs | 2 +- .../Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs index 18b82bb8be..5da11fe767 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.EntityFrameworkCore/Volo/Abp/TenantManagement/EntityFrameworkCore/EfCoreTenantRepository.cs @@ -62,7 +62,7 @@ namespace Volo.Abp.TenantManagement.EntityFrameworkCore u => u.Name.Contains(filter) ) - .OrderBy(sorting ?? nameof(Tenant.Name)) + .OrderBy(sorting.IsNullOrEmpty() ? nameof(Tenant.Name) : sorting) .PageBy(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs index a2805f7333..96d997e417 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs @@ -56,7 +56,7 @@ namespace Volo.Abp.TenantManagement.MongoDB u => u.Name.Contains(filter) ) - .OrderBy(sorting ?? nameof(Tenant.Name)) + .OrderBy(sorting.IsNullOrEmpty() ? nameof(Tenant.Name) : sorting) .As>() .PageBy>(skipCount, maxResultCount) .ToListAsync(GetCancellationToken(cancellationToken));