Table of Contents

Class WrappingCoreSession

Namespace
MongoDB.Driver.Core.Bindings
Assembly
MongoDB.Driver.Core.dll

An abstract base class for a core session that wraps another core session.

public abstract class WrappingCoreSession : ICoreSession, IDisposable
Inheritance
WrappingCoreSession
Implements
Derived
Inherited Members

Constructors

WrappingCoreSession(ICoreSession, bool)

Initializes a new instance of the WrappingCoreSession class.

public WrappingCoreSession(ICoreSession wrapped, bool ownsWrapped)

Parameters

wrapped ICoreSession

The wrapped.

ownsWrapped bool

if set to true [owns wrapped].

See Also

Properties

ClusterTime

Gets the cluster time.

public virtual BsonDocument ClusterTime { get; }

Property Value

BsonDocument

The cluster time.

See Also

CurrentTransaction

Gets the current transaction.

public virtual CoreTransaction CurrentTransaction { get; }

Property Value

CoreTransaction

The current transaction.

See Also

Id

Gets the session Id.

public virtual BsonDocument Id { get; }

Property Value

BsonDocument

The session Id.

See Also

IsCausallyConsistent

Gets a value indicate whether this instance is causally consistent.

public virtual bool IsCausallyConsistent { get; }

Property Value

bool

true if the session is causally consistent.

See Also

IsDirty

Gets a value indicate whether this session is dirty.

public virtual bool IsDirty { get; }

Property Value

bool

true if the session is dirty.

See Also

IsImplicit

Gets a value indicating whether this instance is implicit session.

public virtual bool IsImplicit { get; }

Property Value

bool

true if this instance is implicit session; otherwise, false.

See Also

IsInTransaction

Gets a value indicating whether this instance is in a transaction.

public virtual bool IsInTransaction { get; }

Property Value

bool

true if this instance is in a transaction; otherwise, false.

See Also

IsSnapshot

Gets a value indicate whether this instance is a snapshot session.

public bool IsSnapshot { get; }

Property Value

bool

true if the session is a snapshot session.

See Also

OperationTime

Gets the operation time.

public virtual BsonTimestamp OperationTime { get; }

Property Value

BsonTimestamp

The operation time.

See Also

Options

Gets the session options.

public virtual CoreSessionOptions Options { get; }

Property Value

CoreSessionOptions

The session options.

See Also

ServerSession

Gets the server session.

public virtual ICoreServerSession ServerSession { get; }

Property Value

ICoreServerSession

The server session.

See Also

SnapshotTime

Gets the snapshot time.

public BsonTimestamp SnapshotTime { get; }

Property Value

BsonTimestamp

The snapshot time.

See Also

Wrapped

Gets the wrapped session.

public ICoreSession Wrapped { get; }

Property Value

ICoreSession

The wrapped session.

See Also

Methods

AbortTransaction(CancellationToken)

Aborts the transaction.

public virtual void AbortTransaction(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

See Also

AbortTransactionAsync(CancellationToken)

Aborts the transaction.

public virtual Task AbortTransactionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

See Also

AboutToSendCommand()

The driver is about to send a command on this session. Called to track session state.

public virtual void AboutToSendCommand()
See Also

AdvanceClusterTime(BsonDocument)

Advances the cluster time.

public virtual void AdvanceClusterTime(BsonDocument newClusterTime)

Parameters

newClusterTime BsonDocument

The new cluster time.

See Also

AdvanceOperationTime(BsonTimestamp)

Advances the operation time.

public virtual void AdvanceOperationTime(BsonTimestamp newOperationTime)

Parameters

newOperationTime BsonTimestamp

The new operation time.

See Also

AdvanceTransactionNumber()

Advances the transaction id.

public long AdvanceTransactionNumber()

Returns

long

The transaction id.

See Also

CommitTransaction(CancellationToken)

Commits the transaction.

public virtual void CommitTransaction(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

See Also

CommitTransactionAsync(CancellationToken)

Commits the transaction.

public virtual Task CommitTransactionAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

The cancellation token.

Returns

Task

A Task.

See Also

Dispose()

public void Dispose()
See Also

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

See Also

IsDisposed()

Determines whether this instance is disposed.

protected bool IsDisposed()

Returns

bool

true if this instance is disposed; otherwise, false.

See Also

MarkDirty()

Marks the session as dirty.

public virtual void MarkDirty()
See Also

SetSnapshotTimeIfNeeded(BsonTimestamp)

Sets the snapshot time if not set.

public void SetSnapshotTimeIfNeeded(BsonTimestamp snapshotTime)

Parameters

snapshotTime BsonTimestamp

The snapshot time.

See Also

StartTransaction(TransactionOptions)

Starts a transaction.

public virtual void StartTransaction(TransactionOptions transactionOptions = null)

Parameters

transactionOptions TransactionOptions

The transaction options.

See Also

ThrowIfDisposed()

Throws if disposed.

protected void ThrowIfDisposed()

Exceptions

ObjectDisposedException
See Also

WasUsed()

Called by the driver when the session is used (i.e. sent to the server).

public virtual void WasUsed()
See Also

See Also