Interface IRepositoryCollection<TEntity, TKey>
public interface IRepositoryCollection<TEntity, TKey> : IReadOnlyRepositoryCollection<TEntity, TKey>, IRepositoryCollection, IReadOnlyRepositoryCollection where TEntity : EntityBase<TKey>
Type Parameters
TEntityTKey
- Inherited Members
Methods
AddAsync(TEntity, IClientSessionHandle)
Task AddAsync(TEntity entity, IClientSessionHandle session = null)
Parameters
entityTEntitysessionIClientSessionHandle
Returns
AddManyAsync(IEnumerable<TEntity>, IClientSessionHandle)
Task AddManyAsync(IEnumerable<TEntity> entities, IClientSessionHandle session = null)
Parameters
entitiesIEnumerable<TEntity>sessionIClientSessionHandle
Returns
DeleteOneAsync(TKey, IClientSessionHandle)
Task<TEntity> DeleteOneAsync(TKey id, IClientSessionHandle session = null)
Parameters
idTKeysessionIClientSessionHandle
Returns
- Task<TEntity>
ExecuteAsync<T>(Func<IMongoCollection<TEntity>, CancellationToken, Task<T>>, Operation, CancellationToken)
Task<T> ExecuteAsync<T>(Func<IMongoCollection<TEntity>, CancellationToken, Task<T>> execute, Operation operation, CancellationToken cancellationToken)
Parameters
executeFunc<IMongoCollection<TEntity>, CancellationToken, Task<T>>operationOperationcancellationTokenCancellationToken
Returns
- Task<T>
Type Parameters
T
ExecuteAsync<T>(Func<IMongoCollection<TEntity>, Task<T>>, Operation)
Task<T> ExecuteAsync<T>(Func<IMongoCollection<TEntity>, Task<T>> execute, Operation operation)
Parameters
Returns
- Task<T>
Type Parameters
T
ExecuteManyAsync<T>(Func<IMongoCollection<TEntity>, CancellationToken, Task<IAsyncCursor<T>>>, CancellationToken)
IAsyncEnumerable<T> ExecuteManyAsync<T>(Func<IMongoCollection<TEntity>, CancellationToken, Task<IAsyncCursor<T>>> queryFactory, CancellationToken cancellationToken = default)
Parameters
queryFactoryFunc<IMongoCollection<TEntity>, CancellationToken, Task<IAsyncCursor<T>>>cancellationTokenCancellationToken
Returns
Type Parameters
T
GetPageAsync(int, PagePosition, Expression<Func<TEntity, bool>>, Expression<Func<TEntity, object>>, bool, CancellationToken)
Keyset (seek-based) pagination. Cost is O(log N) per page regardless of how deep the page sits —
no skip penalty on deep pages or "jump to last." Single-column sort only; total count is intentionally
not part of the result and should be obtained via CountAsync(predicate) separately.
Task<CursorPage<TEntity>> GetPageAsync(int pageSize, PagePosition position, Expression<Func<TEntity, bool>> predicate = null, Expression<Func<TEntity, object>> sortBy = null, bool ascending = true, CancellationToken cancellationToken = default)
Parameters
pageSizeintpositionPagePositionpredicateExpression<Func<TEntity, bool>>sortByExpression<Func<TEntity, object>>ascendingboolcancellationTokenCancellationToken
Returns
- Task<CursorPage<TEntity>>
GetPageProjectionAsync<T>(int, PagePosition, Expression<Func<TEntity, T>>, Expression<Func<TEntity, bool>>, Expression<Func<TEntity, object>>, bool, CancellationToken)
Projection variant of GetPageAsync(int, PagePosition, Expression<Func<TEntity, bool>>, Expression<Func<TEntity, object>>, bool, CancellationToken) — returns the projected shape T instead of the entity.
Task<CursorPage<T>> GetPageProjectionAsync<T>(int pageSize, PagePosition position, Expression<Func<TEntity, T>> projection, Expression<Func<TEntity, bool>> predicate = null, Expression<Func<TEntity, object>> sortBy = null, bool ascending = true, CancellationToken cancellationToken = default)
Parameters
pageSizeintpositionPagePositionprojectionExpression<Func<TEntity, T>>predicateExpression<Func<TEntity, bool>>sortByExpression<Func<TEntity, object>>ascendingboolcancellationTokenCancellationToken
Returns
- Task<CursorPage<T>>
Type Parameters
T
TryAddAsync(TEntity, IClientSessionHandle)
Task<bool> TryAddAsync(TEntity entity, IClientSessionHandle session = null)
Parameters
entityTEntitysessionIClientSessionHandle