using System.Linq.Expressions;
using MyNewProjectName.Domain.Common;
namespace MyNewProjectName.Domain.Interfaces;
///
/// Generic repository interface
///
/// Entity type
public interface IRepository where T : BaseEntity
{
Task GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
Task> GetAllAsync(CancellationToken cancellationToken = default);
Task> FindAsync(Expression> predicate, CancellationToken cancellationToken = default);
Task FirstOrDefaultAsync(Expression> predicate, CancellationToken cancellationToken = default);
Task AnyAsync(Expression> predicate, CancellationToken cancellationToken = default);
Task CountAsync(Expression>? predicate = null, CancellationToken cancellationToken = default);
Task AddAsync(T entity, CancellationToken cancellationToken = default);
Task AddRangeAsync(IEnumerable entities, CancellationToken cancellationToken = default);
void Update(T entity);
void UpdateRange(IEnumerable entities);
void Remove(T entity);
void RemoveRange(IEnumerable entities);
}