IRepository<T> Generic CRUD, IUnitOfWork 트랜잭션, 도메인별 특화 Repository 인터페이스 7종 정의 (Service, Admin, Device, Message, PushLog, File, Stat)
22 lines
757 B
C#
22 lines
757 B
C#
using System.Linq.Expressions;
|
|
using SPMS.Domain.Entities;
|
|
|
|
namespace SPMS.Domain.Interfaces;
|
|
|
|
public interface IRepository<T> where T : BaseEntity
|
|
{
|
|
Task<T?> GetByIdAsync(long id);
|
|
Task<IReadOnlyList<T>> GetAllAsync();
|
|
Task<IReadOnlyList<T>> FindAsync(Expression<Func<T, bool>> predicate);
|
|
Task<(IReadOnlyList<T> Items, int TotalCount)> GetPagedAsync(
|
|
int page, int size,
|
|
Expression<Func<T, bool>>? predicate = null,
|
|
Expression<Func<T, object>>? orderBy = null,
|
|
bool descending = true);
|
|
Task<int> CountAsync(Expression<Func<T, bool>>? predicate = null);
|
|
Task<bool> ExistsAsync(Expression<Func<T, bool>> predicate);
|
|
Task AddAsync(T entity);
|
|
void Update(T entity);
|
|
void Delete(T entity);
|
|
}
|