mirror of
https://github.com/Shchoholiev/shopping-assistant-api.git
synced 2025-04-04 16:49:36 +00:00
26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
using MongoDB.Bson;
|
|
using ShoppingAssistantApi.Domain.Common;
|
|
using System.Linq.Expressions;
|
|
|
|
namespace ShoppingAssistantApi.Application.IRepositories;
|
|
|
|
public interface IBaseRepository<TEntity> where TEntity : EntityBase
|
|
{
|
|
Task<TEntity> AddAsync(TEntity entity, CancellationToken cancellationToken);
|
|
|
|
Task<TEntity> GetOneAsync(ObjectId id, CancellationToken cancellationToken);
|
|
|
|
Task<TEntity> GetOneAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
|
|
|
|
Task<List<TEntity>> GetPageAsync(int pageNumber, int pageSize, CancellationToken cancellationToken);
|
|
|
|
Task<List<TEntity>> GetPageAsync(int pageNumber, int pageSize, Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
|
|
|
|
Task<bool> ExistsAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
|
|
|
|
Task<int> GetTotalCountAsync();
|
|
|
|
Task<int> GetCountAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken);
|
|
|
|
Task<TEntity> DeleteAsync(TEntity entity, CancellationToken cancellationToken);
|
|
} |