コード例 #1
0
        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 DeleteOpcodeOperationEmulator(_collectionNamespace, _request, _messageEncoderSettings)
                {
                    WriteConcern = _writeConcern
                };
                return(await emulator.ExecuteAsync(channel, cancellationToken).ConfigureAwait(false));
            }
            else
            {
                return(await ExecuteProtocolAsync(channel, cancellationToken).ConfigureAwait(false));
            }
        }
コード例 #2
0
        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 DeleteOpcodeOperationEmulator(_collectionNamespace, _request, _messageEncoderSettings)
                {
                    WriteConcern = _writeConcern
                };
                return(await emulator.ExecuteAsync(connection, timeout, cancellationToken).ConfigureAwait(false));
            }
            else
            {
                var protocol = CreateProtocol();
                return(await protocol.ExecuteAsync(connection, timeout, cancellationToken).ConfigureAwait(false));
            }
        }