diff --git a/src/Umbraco.Core/Services/EntityTypeContainerService.cs b/src/Umbraco.Core/Services/EntityTypeContainerService.cs index 9263d07530c2..962d853ce818 100644 --- a/src/Umbraco.Core/Services/EntityTypeContainerService.cs +++ b/src/Umbraco.Core/Services/EntityTypeContainerService.cs @@ -50,6 +50,22 @@ protected EntityTypeContainerService( return await Task.FromResult(_entityContainerRepository.Get(id)); } + + /// + 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 e58e3223040c..831eb4b2e452 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 ///