From e514b703aa7994c910e3c853e07192b1db803a26 Mon Sep 17 00:00:00 2001 From: yv01p Date: Wed, 24 Dec 2025 19:15:31 +0000 Subject: [PATCH] refactor(core): remove unused fields from ContentService MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove fields that are now handled by extracted services: - IDocumentBlueprintRepository (BlueprintManager) - IPropertyValidationService (extracted services) - ICultureImpactFactory (extracted services) - PropertyEditorCollection (extracted services) - ContentSettings + optionsMonitor.OnChange callback - IRelationService (ContentMoveOperationService) - IEntityRepository (unused) - ILanguageRepository (extracted services) Keep _shortStringHelper temporarily (will move to ContentCrudService in Task 5). Simplify constructor to only inject dependencies still used directly. Update UmbracoBuilder.cs DI registration to match new constructor. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .../DependencyInjection/UmbracoBuilder.cs | 8 ---- src/Umbraco.Core/Services/ContentService.cs | 48 +++---------------- 2 files changed, 7 insertions(+), 49 deletions(-) diff --git a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs index 3212750d5a..a2ca60f312 100644 --- a/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs +++ b/src/Umbraco.Core/DependencyInjection/UmbracoBuilder.cs @@ -313,19 +313,11 @@ namespace Umbraco.Cms.Core.DependencyInjection sp.GetRequiredService(), sp.GetRequiredService(), sp.GetRequiredService(), - sp.GetRequiredService(), sp.GetRequiredService(), sp.GetRequiredService(), - sp.GetRequiredService(), - sp.GetRequiredService(), - sp.GetRequiredService>(), sp.GetRequiredService(), - sp.GetRequiredService(), sp.GetRequiredService(), - sp.GetRequiredService(), sp.GetRequiredService(), - sp.GetRequiredService>(), - sp.GetRequiredService(), sp.GetRequiredService(), sp.GetRequiredService(), sp.GetRequiredService(), diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 575b186cd7..7379e3d923 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -32,19 +32,11 @@ public class ContentService : RepositoryService, IContentService { private readonly IAuditService _auditService; private readonly IContentTypeRepository _contentTypeRepository; - private readonly IDocumentBlueprintRepository _documentBlueprintRepository; private readonly IDocumentRepository _documentRepository; - private readonly IEntityRepository _entityRepository; - private readonly ILanguageRepository _languageRepository; private readonly ILogger _logger; - private readonly Lazy _propertyValidationService; private readonly IShortStringHelper _shortStringHelper; - private readonly ICultureImpactFactory _cultureImpactFactory; private readonly IUserIdKeyResolver _userIdKeyResolver; - private readonly PropertyEditorCollection _propertyEditorCollection; private readonly IIdKeyMap _idKeyMap; - private ContentSettings _contentSettings; - private readonly IRelationService _relationService; private IQuery? _queryNotTrashed; private readonly Lazy _crudServiceLazy; @@ -95,72 +87,46 @@ public class ContentService : RepositoryService, IContentService ILoggerFactory loggerFactory, IEventMessagesFactory eventMessagesFactory, IDocumentRepository documentRepository, - IEntityRepository entityRepository, IAuditService auditService, IContentTypeRepository contentTypeRepository, - IDocumentBlueprintRepository documentBlueprintRepository, - ILanguageRepository languageRepository, - Lazy propertyValidationService, IShortStringHelper shortStringHelper, - ICultureImpactFactory cultureImpactFactory, IUserIdKeyResolver userIdKeyResolver, - PropertyEditorCollection propertyEditorCollection, IIdKeyMap idKeyMap, - IOptionsMonitor optionsMonitor, - IRelationService relationService, IContentCrudService crudService, - IContentQueryOperationService queryOperationService, // NEW PARAMETER - Phase 2 query operations - IContentVersionOperationService versionOperationService, // NEW PARAMETER - Phase 3 version operations - IContentMoveOperationService moveOperationService, // NEW PARAMETER - Phase 4 move operations - IContentPublishOperationService publishOperationService, // NEW PARAMETER - Phase 5 publish operations - ContentPermissionManager permissionManager, // NEW PARAMETER - Phase 6 permission operations - ContentBlueprintManager blueprintManager) // NEW PARAMETER - Phase 7 blueprint operations + IContentQueryOperationService queryOperationService, + IContentVersionOperationService versionOperationService, + IContentMoveOperationService moveOperationService, + IContentPublishOperationService publishOperationService, + ContentPermissionManager permissionManager, + ContentBlueprintManager blueprintManager) : base(provider, loggerFactory, eventMessagesFactory) { _documentRepository = documentRepository; - _entityRepository = entityRepository; _auditService = auditService; _contentTypeRepository = contentTypeRepository; - _documentBlueprintRepository = documentBlueprintRepository; - _languageRepository = languageRepository; - _propertyValidationService = propertyValidationService; _shortStringHelper = shortStringHelper; - _cultureImpactFactory = cultureImpactFactory; _userIdKeyResolver = userIdKeyResolver; - _propertyEditorCollection = propertyEditorCollection; _idKeyMap = idKeyMap; - _contentSettings = optionsMonitor.CurrentValue; - optionsMonitor.OnChange((contentSettings) => - { - _contentSettings = contentSettings; - }); - _relationService = relationService; _logger = loggerFactory.CreateLogger(); + ArgumentNullException.ThrowIfNull(crudService); - // Wrap in Lazy for consistent access pattern (already resolved, so returns immediately) _crudServiceLazy = new Lazy(() => crudService); - // Phase 2: Query operation service (direct injection) ArgumentNullException.ThrowIfNull(queryOperationService); _queryOperationService = queryOperationService; - // Phase 3: Version operation service (direct injection) ArgumentNullException.ThrowIfNull(versionOperationService); _versionOperationService = versionOperationService; - // Phase 4: Move operation service (direct injection) ArgumentNullException.ThrowIfNull(moveOperationService); _moveOperationService = moveOperationService; - // Phase 5: Publish operation service (direct injection) ArgumentNullException.ThrowIfNull(publishOperationService); _publishOperationService = publishOperationService; - // Phase 6: Permission manager (direct injection) ArgumentNullException.ThrowIfNull(permissionManager); _permissionManager = permissionManager; - // Phase 7: Blueprint manager (direct injection) ArgumentNullException.ThrowIfNull(blueprintManager); _blueprintManager = blueprintManager; }