namespace DigitalData.Core.Contracts.Infrastructure
{
///
/// Defines the contract for CRUD operations on a repository for entities of type TEntity.
///
/// The type of the entity this repository works with.
/// The type of the identifier for the entity.
public interface ICRUDRepository where TEntity : class
{
///
/// Adds a new entity to the repository.
///
/// The entity to add.
/// The added entity, or null if the entity cannot be added.
Task CreateAsync(TEntity entity);
///
/// Retrieves an entity by its identifier from the repository.
///
/// The identifier of the entity to retrieve.
/// The entity found, or null if no entity is found.
Task ReadByIdAsync(TId id);
///
/// Retrieves all entities from the repository.
///
/// A collection of all entities.
Task> ReadAllAsync();
///
/// Updates an existing entity in the repository.
///
/// The entity to update.
/// The updated entity.
Task UpdateAsync(TEntity entity);
///
/// Deletes an entity from the repository.
///
/// The entity to delete.
/// If entity is deleted, return true othwerwise return false.
Task DeleteAsync(TEntity entity);
}
}