#if NET
namespace DigitalData.Core.Abstraction.Application.Repository
{
///
/// 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.
[Obsolete("Use IRepository")]
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);
///
/// Asynchronously counts all entities in the repository.
///
/// The total number of entities in the repository.
Task CountAsync();
///
/// Asynchronously counts the number of entities in the repository that match a specific identifier.
///
/// The identifier of the entities to count.
/// The number of entities with the specified identifier.
///
/// This method provides a count of entities in the database that match the given identifier.
/// If there are multiple entities with the same identifier, they will all be counted.
/// The default implementation assumes that the identifier is unique for each entity.
///
Task CountAsync(TId id);
}
}
#endif