Skip to content

Commit

Permalink
Introduced methods on the IEntityTypeContainerService, so have altern…
Browse files Browse the repository at this point in the history
…atives for obsoleted methods. E.g. IDataTypeService.GetContainers(string folderName, int level) and a GetAllAsync (#17208)
  • Loading branch information
bergmania authored Oct 9, 2024
1 parent ea073e6 commit a396335
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Umbraco.Core/Services/EntityTypeContainerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ protected EntityTypeContainerService(
return await Task.FromResult(_entityContainerRepository.Get(id));
}


/// <inheritdoc />
public async Task<IEnumerable<EntityContainer>> GetAsync(string name, int level)
{
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
ReadLock(scope);
return await Task.FromResult(_entityContainerRepository.Get(name, level));
}
/// <inheritdoc />
public async Task<IEnumerable<EntityContainer>> GetAllAsync()
{
using ICoreScope scope = ScopeProvider.CreateCoreScope(autoComplete: true);
ReadLock(scope);
return await Task.FromResult(_entityContainerRepository.GetMany());
}

/// <inheritdoc />
public async Task<EntityContainer?> GetParentAsync(EntityContainer container)
=> await Task.FromResult(GetParent(container));
Expand Down
14 changes: 14 additions & 0 deletions src/Umbraco.Core/Services/IEntityTypeContainerService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,20 @@ public interface IEntityTypeContainerService<TTreeEntity>
/// <returns></returns>
Task<EntityContainer?> GetAsync(Guid id);

/// <summary>
/// Gets containers by name and level
/// </summary>
/// <param name="name">The name of the containers to get.</param>
/// <param name="level">The level in the tree of the containers to get.</param>
/// <returns></returns>
Task<IEnumerable<EntityContainer>> GetAsync(string name, int level);

/// <summary>
/// Gets all containers
/// </summary>
/// <returns></returns>
Task<IEnumerable<EntityContainer>> GetAllAsync();

/// <summary>
/// Gets the parent container of a container
/// </summary>
Expand Down

0 comments on commit a396335

Please sign in to comment.