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:
@@ -108,10 +108,6 @@ namespace DigitalData.Core.Application
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">The identifier of the entity to check.</param>
|
/// <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>
|
/// <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)
|
public virtual async Task<bool> HasEntity(TId id) => await _repository.CountAsync(id) > 0;
|
||||||
{
|
|
||||||
var entity = await _repository.ReadByIdAsync(id);
|
|
||||||
return entity is not null;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user