Skip to content

Commit 69817b3

Browse files
authored
Merge pull request #22113 from abpframework/cms-patch
Fix Blog post tag filtering problem
2 parents 7b14b63 + 9569065 commit 69817b3

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ public virtual async Task<int> GetCountAsync(
5353
BlogPostStatus? statusFilter = null,
5454
CancellationToken cancellationToken = default)
5555
{
56-
List<string> entityIdFilters = null;
56+
List<Guid> entityIdFilters = null;
5757
if (tagId.HasValue)
5858
{
59-
entityIdFilters = await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken);
59+
entityIdFilters = (await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken)).Select(Guid.Parse).ToList();
6060
}
6161

6262
var queryable = (await GetDbSetAsync())
63-
.WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id.ToString()))
63+
.WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id))
6464
.WhereIf(blogId.HasValue, x => x.BlogId == blogId)
6565
.WhereIf(authorId.HasValue, x => x.AuthorId == authorId)
6666
.WhereIf(statusFilter.HasValue, x => x.Status == statusFilter)
@@ -86,14 +86,14 @@ public virtual async Task<List<BlogPost>> GetListAsync(
8686
var blogPostsDbSet = dbContext.Set<BlogPost>();
8787
var usersDbSet = dbContext.Set<CmsUser>();
8888

89-
List<string> entityIdFilters = null;
89+
List<Guid> entityIdFilters = null;
9090
if (tagId.HasValue)
9191
{
92-
entityIdFilters = await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken);
92+
entityIdFilters = (await _entityTagManager.GetEntityIdsFilteredByTagAsync(tagId.Value, CurrentTenant.Id, cancellationToken)).Select(Guid.Parse).ToList();
9393
}
9494

9595
var queryable = (await GetDbSetAsync())
96-
.WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id.ToString()))
96+
.WhereIf(entityIdFilters != null, x => entityIdFilters.Contains(x.Id))
9797
.WhereIf(blogId.HasValue, x => x.BlogId == blogId)
9898
.WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter))
9999
.WhereIf(authorId.HasValue, x => x.AuthorId == authorId)

0 commit comments

Comments
 (0)