Table of Contents

Class RetryableWriteCommandOperationBase

Namespace
MongoDB.Driver.Core.Operations
Assembly
MongoDB.Driver.Core.dll

Represents a base class for a delete, insert or update command operation.

public abstract class RetryableWriteCommandOperationBase : IWriteOperation<BsonDocument>, IRetryableWriteOperation<BsonDocument>, IExecutableInRetryableWriteContext<BsonDocument>
Inheritance
RetryableWriteCommandOperationBase
Implements
Derived
Inherited Members
Extension Methods

Constructors

RetryableWriteCommandOperationBase(DatabaseNamespace, MessageEncoderSettings)

Initializes a new instance of the RetryableWriteCommandOperationBase class.

public RetryableWriteCommandOperationBase(DatabaseNamespace databaseNamespace, MessageEncoderSettings messageEncoderSettings)

Parameters

databaseNamespace DatabaseNamespace

The database namespace.

messageEncoderSettings MessageEncoderSettings

The message encoder settings.

Properties

Comment

Gets or sets the comment.

public BsonValue Comment { get; set; }

Property Value

BsonValue

The comment.

DatabaseNamespace

Gets the database namespace.

public DatabaseNamespace DatabaseNamespace { get; }

Property Value

DatabaseNamespace

The database namespace.

IsOrdered

Gets or sets a value indicating whether the server should process the requests in order.

public bool IsOrdered { get; set; }

Property Value

bool

A value indicating whether the server should process the requests in order.

MaxBatchCount

Gets or sets the maximum batch count.

public int? MaxBatchCount { get; set; }

Property Value

int?

The maximum batch count.

MessageEncoderSettings

Gets the message encoder settings.

public MessageEncoderSettings MessageEncoderSettings { get; }

Property Value

MessageEncoderSettings

The message encoder settings.

RetryRequested

Gets or sets a value indicating whether retry is enabled for the operation.

public bool RetryRequested { get; set; }

Property Value

bool

A value indicating whether retry is enabled.

WriteConcern

Gets or sets the write concern.

public WriteConcern WriteConcern { get; set; }

Property Value

WriteConcern

The write concern.

Methods

CreateCommand(ICoreSessionHandle, int, long?)

Creates the command.

protected abstract BsonDocument CreateCommand(ICoreSessionHandle session, int attempt, long? transactionNumber)

Parameters

session ICoreSessionHandle

The session.

attempt int

The attempt.

transactionNumber long?

The transaction number.

Returns

BsonDocument

A command.

CreateCommandPayloads(IChannelHandle, int)

Creates the command payloads.

protected abstract IEnumerable<Type1CommandMessageSection> CreateCommandPayloads(IChannelHandle channel, int attempt)

Parameters

channel IChannelHandle

The channel.

attempt int

The attempt.

Returns

IEnumerable<Type1CommandMessageSection>

The command payloads.

Execute(IWriteBinding, CancellationToken)

Executes the operation.

public virtual BsonDocument Execute(IWriteBinding binding, CancellationToken cancellationToken)

Parameters

binding IWriteBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

BsonDocument

The result of the operation.

Execute(RetryableWriteContext, CancellationToken)

Executes the first attempt.

public virtual BsonDocument Execute(RetryableWriteContext context, CancellationToken cancellationToken)

Parameters

context RetryableWriteContext

The context.

cancellationToken CancellationToken

The cancellation token.

Returns

BsonDocument

The result.

ExecuteAsync(IWriteBinding, CancellationToken)

Executes the operation.

public virtual Task<BsonDocument> ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)

Parameters

binding IWriteBinding

The binding.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<BsonDocument>

A Task whose result is the result of the operation.

ExecuteAsync(RetryableWriteContext, CancellationToken)

Executes the first attempt.

public virtual Task<BsonDocument> ExecuteAsync(RetryableWriteContext context, CancellationToken cancellationToken)

Parameters

context RetryableWriteContext

The context.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<BsonDocument>

The result.

ExecuteAttempt(RetryableWriteContext, int, long?, CancellationToken)

Executes the first attempt.

public BsonDocument ExecuteAttempt(RetryableWriteContext context, int attempt, long? transactionNumber, CancellationToken cancellationToken)

Parameters

context RetryableWriteContext

The context.

attempt int

The attempt.

transactionNumber long?

The transaction number.

cancellationToken CancellationToken

The cancellation token.

Returns

BsonDocument

The result.

ExecuteAttemptAsync(RetryableWriteContext, int, long?, CancellationToken)

Executes the first attempt.

public Task<BsonDocument> ExecuteAttemptAsync(RetryableWriteContext context, int attempt, long? transactionNumber, CancellationToken cancellationToken)

Parameters

context RetryableWriteContext

The context.

attempt int

The attempt.

transactionNumber long?

The transaction number.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<BsonDocument>

The result.