Introduced methods on the IEntityTypeContainerService, so have alternatives for obsoleted methods. E.g. IDataTypeService.GetContainers(string folderName, int level) and a GetAllAsync (#17208)

This commit is contained in:
Bjarke Berg
2024-10-09 09:55:44 +02:00
committed by GitHub
parent ea073e6158
commit a3963359d2
2 changed files with 30 additions and 0 deletions

View File

@@ -50,6 +50,22 @@ internal abstract class EntityTypeContainerService<TTreeEntity, TEntityContainer
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));

View File

@@ -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>