From a3963359d24389a6f8074785f0818d7968ab126d Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Wed, 9 Oct 2024 09:55:44 +0200 Subject: [PATCH] Introduced methods on the IEntityTypeContainerService, so have alternatives for obsoleted methods. E.g. IDataTypeService.GetContainers(string folderName, int level) and a GetAllAsync (#17208) --- .../Services/EntityTypeContainerService.cs | 16 ++++++++++++++++ .../Services/IEntityTypeContainerService.cs | 14 ++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/Umbraco.Core/Services/EntityTypeContainerService.cs b/src/Umbraco.Core/Services/EntityTypeContainerService.cs index 9263d07530..962d853ce8 100644 --- a/src/Umbraco.Core/Services/EntityTypeContainerService.cs +++ b/src/Umbraco.Core/Services/EntityTypeContainerService.cs @@ -50,6 +50,22 @@ internal abstract class EntityTypeContainerService + public async Task> GetAsync(string name, int level) + { + using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true); + ReadLock(scope); + return await Task.FromResult(_entityContainerRepository.Get(name, level)); + } + /// + public async Task> GetAllAsync() + { + using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true); + ReadLock(scope); + return await Task.FromResult(_entityContainerRepository.GetMany()); + } + /// public async Task GetParentAsync(EntityContainer container) => await Task.FromResult(GetParent(container)); diff --git a/src/Umbraco.Core/Services/IEntityTypeContainerService.cs b/src/Umbraco.Core/Services/IEntityTypeContainerService.cs index e58e322304..831eb4b2e4 100644 --- a/src/Umbraco.Core/Services/IEntityTypeContainerService.cs +++ b/src/Umbraco.Core/Services/IEntityTypeContainerService.cs @@ -14,6 +14,20 @@ public interface IEntityTypeContainerService /// Task GetAsync(Guid id); + /// + /// Gets containers by name and level + /// + /// The name of the containers to get. + /// The level in the tree of the containers to get. + /// + Task> GetAsync(string name, int level); + + /// + /// Gets all containers + /// + /// + Task> GetAllAsync(); + /// /// Gets the parent container of a container ///