From 95690651236a343a8d7c2399d68f4fcb6f2e625c Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Tue, 11 Feb 2025 11:19:19 +0800 Subject: [PATCH] Fix Blog post tag filtering problem --- .../Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index 266a04a910..58527c00de 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -53,14 +53,14 @@ public class EfCoreBlogPostRepository : EfCoreRepository entityIdFilters = null; + List entityIdFilters = null; if (tagId.HasValue) { - entityIdFilters = await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken); + entityIdFilters = (await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken)).Select(Guid.Parse).ToList(); } var queryable = (await GetDbSetAsync()) - .WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id.ToString())) + .WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id)) .WhereIf(blogId.HasValue, x => x.BlogId == blogId) .WhereIf(authorId.HasValue, x => x.AuthorId == authorId) .WhereIf(statusFilter.HasValue, x => x.Status == statusFilter) @@ -86,14 +86,14 @@ public class EfCoreBlogPostRepository : EfCoreRepository(); var usersDbSet = dbContext.Set(); - List entityIdFilters = null; + List entityIdFilters = null; if (tagId.HasValue) { - entityIdFilters = await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken); + entityIdFilters = (await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken)).Select(Guid.Parse).ToList(); } var queryable = (await GetDbSetAsync()) - .WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id.ToString())) + .WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id)) .WhereIf(blogId.HasValue, x => x.BlogId == blogId) .WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)) .WhereIf(authorId.HasValue, x => x.AuthorId == authorId)