private async Task <WriteConcernResult> ExecuteAsync(IChannelHandle channel, CancellationToken cancellationToken) { Ensure.IsNotNull(channel, "channel"); if (channel.ConnectionDescription.BuildInfoResult.ServerVersion >= new SemanticVersion(2, 6, 0) && _writeConcern.IsAcknowledged) { var emulator = new UpdateOpcodeOperationEmulator(_collectionNamespace, _request, _messageEncoderSettings) { MaxDocumentSize = _maxDocumentSize, WriteConcern = _writeConcern }; return(await emulator.ExecuteAsync(channel, cancellationToken).ConfigureAwait(false)); } else { return(await ExecuteProtocolAsync(channel, cancellationToken).ConfigureAwait(false)); } }
public async Task <WriteConcernResult> ExecuteAsync(IConnectionHandle connection, TimeSpan timeout = default(TimeSpan), CancellationToken cancellationToken = default(CancellationToken)) { Ensure.IsNotNull(connection, "connection"); if (connection.Description.BuildInfoResult.ServerVersion >= new SemanticVersion(2, 6, 0) && _writeConcern.IsAcknowledged) { var emulator = new UpdateOpcodeOperationEmulator(_collectionNamespace, _request, _messageEncoderSettings) { MaxDocumentSize = _maxDocumentSize, WriteConcern = _writeConcern }; return(await emulator.ExecuteAsync(connection, timeout, cancellationToken)); } else { var protocol = CreateProtocol(); return(await protocol.ExecuteAsync(connection, timeout, cancellationToken)); } }