fix: HasEntity-Methode auf CountAsync aktualisiert

Die Implementierung der HasEntity-Methode wurde ersetzt, um die CountAsync-Methode des Repositories zu verwenden. Dies sorgt für eine effizientere Überprüfung der Existenz von Entitäten.
This commit is contained in:
Developer 02 2024-09-11 10:54:41 +02:00
parent 406a41b91f
commit b6ac303c96

View File

@ -108,10 +108,6 @@ namespace DigitalData.Core.Application
/// </summary>
/// <param name="id">The identifier of the entity to check.</param>
/// <returns>A Task that represents the asynchronous operation. The task result contains a boolean value indicating whether the entity exists.</returns>
public virtual async Task<bool> HasEntity(TId id)
{
var entity = await _repository.ReadByIdAsync(id);
return entity is not null;
}
public virtual async Task<bool> HasEntity(TId id) => await _repository.CountAsync(id) > 0;
}
}