first commit
This commit is contained in:
24
MyNewProjectName.Domain/Interfaces/IRepository.cs
Normal file
24
MyNewProjectName.Domain/Interfaces/IRepository.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.Linq.Expressions;
|
||||
using MyNewProjectName.Domain.Common;
|
||||
|
||||
namespace MyNewProjectName.Domain.Interfaces;
|
||||
|
||||
/// <summary>
|
||||
/// Generic repository interface
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Entity type</typeparam>
|
||||
public interface IRepository<T> where T : BaseEntity
|
||||
{
|
||||
Task<T?> GetByIdAsync(Guid id, CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<T>> GetAllAsync(CancellationToken cancellationToken = default);
|
||||
Task<IEnumerable<T>> FindAsync(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default);
|
||||
Task<T?> FirstOrDefaultAsync(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default);
|
||||
Task<bool> AnyAsync(Expression<Func<T, bool>> predicate, CancellationToken cancellationToken = default);
|
||||
Task<int> CountAsync(Expression<Func<T, bool>>? predicate = null, CancellationToken cancellationToken = default);
|
||||
Task AddAsync(T entity, CancellationToken cancellationToken = default);
|
||||
Task AddRangeAsync(IEnumerable<T> entities, CancellationToken cancellationToken = default);
|
||||
void Update(T entity);
|
||||
void UpdateRange(IEnumerable<T> entities);
|
||||
void Remove(T entity);
|
||||
void RemoveRange(IEnumerable<T> entities);
|
||||
}
|
||||
Reference in New Issue
Block a user