refactor(core): delegate Count methods to QueryOperationService

ContentService now delegates Count, CountPublished, CountChildren,
CountDescendants to the new QueryOperationService.

This is Task 5 of Phase 2 - the first delegation task that converts
ContentService from direct repository calls to delegating to the
specialized query operation service.

All tests pass. Baseline tests confirm facade and direct service
return identical results. Full ContentService test suite passes
(excluding pre-existing benchmark regressions).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-12-22 23:46:59 +00:00
parent ff4bdb2509
commit fb20c480e3
2 changed files with 79 additions and 28 deletions

View File

@@ -302,40 +302,16 @@ public class ContentService : RepositoryService, IContentService
#region Count
public int CountPublished(string? contentTypeAlias = null)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
return _documentRepository.CountPublished(contentTypeAlias);
}
}
=> QueryOperationService.CountPublished(contentTypeAlias);
public int Count(string? contentTypeAlias = null)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
return _documentRepository.Count(contentTypeAlias);
}
}
=> QueryOperationService.Count(contentTypeAlias);
public int CountChildren(int parentId, string? contentTypeAlias = null)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
return _documentRepository.CountChildren(parentId, contentTypeAlias);
}
}
=> QueryOperationService.CountChildren(parentId, contentTypeAlias);
public int CountDescendants(int parentId, string? contentTypeAlias = null)
{
using (ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true))
{
scope.ReadLock(Constants.Locks.ContentTree);
return _documentRepository.CountDescendants(parentId, contentTypeAlias);
}
}
=> QueryOperationService.CountDescendants(parentId, contentTypeAlias);
#endregion