Ejemplo n.º 1
0
        protected async Task <IMongoCollection <TEntity> > GetCollectionAsync(CancellationToken cancellationToken)
        {
            if (_collection.Value != null)
            {
                return(_collection.Value);
            }

            _collection.Value = await _context.GetCollectionAsync <TEntity>(cancellationToken);

            return(_collection.Value);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the Mongo collection that backs this repository.
 /// </summary>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns></returns>
 protected async Task <IMongoCollection <TEntity> > GetCollectionAsync(CancellationToken cancellationToken = default) =>
 await _context.GetCollectionAsync <TEntity>(cancellationToken);