36 lines
1007 B
C#
36 lines
1007 B
C#
using Modules.Library.Domain.Entities;
|
|
using System.Linq.Expressions;
|
|
|
|
namespace Modules.Library.Application.Gateways;
|
|
|
|
public interface IRepository<T, TKey>
|
|
{
|
|
Task<List<T>> GetAllAsync();
|
|
|
|
Task<T> GetByIdAsync(TKey id);
|
|
Task<T?> GetByIdOrDefaultAsync(TKey id);
|
|
|
|
Task<List<T>> GetRangeByIdsAsync(List<TKey> ids);
|
|
|
|
Task<T> GetFirstWhere(Expression<Func<T, bool>> predicate);
|
|
Task<T?> GetFirstOrDefaultWhere(Expression<Func<T, bool>> predicate);
|
|
|
|
Task<List<T>> GetWhere(Expression<Func<T, bool>> predicate);
|
|
|
|
Task<bool> AnyWhere(Expression<Func<T, bool>> predicate);
|
|
/*
|
|
Task AddAsync(T entity, IUser user);
|
|
|
|
Task<bool> UpdateAsync(T entity, IUser user);
|
|
|
|
Task<bool> DeleteAsync(T entity, IUser user);
|
|
*/
|
|
Task AddAsync(T entity);
|
|
|
|
Task<bool> UpdateAsync(T entity);
|
|
|
|
Task<bool> DeleteAsync(T entity);
|
|
}
|
|
|
|
public interface IRepository<T> : IRepository<T, string> where T : Entity { }
|
|
//public interface IRepository<T> : IRepository<T, string> { } |