Exemplo n.º 1
0
 private async Task <CursorBatch <TDocument> > GetNextBatchAsync(CancellationToken cancellationToken)
 {
     using (var channel = await _channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false))
     {
         return(await ExecuteGetMoreProtocolAsync(channel, cancellationToken).ConfigureAwait(false));
     }
 }
 private async Task <CursorBatch <TDocument> > GetNextBatchAsync(CancellationToken cancellationToken)
 {
     using (EventContext.BeginOperation(_operationId))
         using (var channel = await _channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false))
         {
             return(await ExecuteGetMoreCommandAsync(channel, cancellationToken).ConfigureAwait(false));
         }
 }
Exemplo n.º 3
0
 private async Task <CursorBatch <TDocument> > GetNextBatchAsync(CancellationToken cancellationToken)
 {
     using (EventContext.BeginOperation(_operationId))
         using (var channel = await _channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false))
         {
             if (Feature.FindCommand.IsSupported(channel.ConnectionDescription.ServerVersion))
             {
                 return(await ExecuteGetMoreCommandAsync(channel, cancellationToken).ConfigureAwait(false));
             }
             else
             {
                 return(await ExecuteGetMoreProtocolAsync(channel, cancellationToken).ConfigureAwait(false));
             }
         }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Executes the protocol.
 /// </summary>
 /// <param name="channelSource">The channel source.</param>
 /// <param name="readPreference">The read preference.</param>
 /// <param name="cancellationToken">The cancellation token.</param>
 /// <returns>A Task whose result is the command result.</returns>
 protected async Task <TCommandResult> ExecuteProtocolAsync(
     IChannelSource channelSource,
     ReadPreference readPreference,
     CancellationToken cancellationToken)
 {
     using (var channel = await channelSource.GetChannelAsync(cancellationToken).ConfigureAwait(false))
     {
         return(await ExecuteProtocolAsync(channel, channelSource.ServerDescription, readPreference, cancellationToken).ConfigureAwait(false));
     }
 }
Exemplo n.º 5
0
 // static methods
 public static IChannelHandle GetChannel(this IChannelSource channelSource, CancellationToken cancellationToken = default(CancellationToken))
 {
     return(channelSource.GetChannelAsync(cancellationToken).GetAwaiter().GetResult());
 }