Interface ICoreSession
The interface for a session in Core.
public interface ICoreSession : IDisposable
- Inherited Members
Properties
ClusterTime
Gets the cluster time.
BsonDocument ClusterTime { get; }
Property Value
- BsonDocument
The cluster time.
CurrentTransaction
Gets the current transaction.
CoreTransaction CurrentTransaction { get; }
Property Value
- CoreTransaction
The current transaction.
Id
Gets the session Id.
BsonDocument Id { get; }
Property Value
- BsonDocument
The session Id.
IsCausallyConsistent
Gets a value indicate whether this instance is causally consistent.
bool IsCausallyConsistent { get; }
Property Value
- bool
true
if the session is causally consistent.
IsDirty
Gets a value indicate whether this session is dirty.
bool IsDirty { get; }
Property Value
- bool
true
if the session is dirty.
IsImplicit
Gets a value indicating whether this instance is implicit session.
bool IsImplicit { get; }
Property Value
- bool
true
if this instance is implicit session; otherwise,false
.
IsInTransaction
Gets a value indicating whether this instance is in a transaction.
bool IsInTransaction { get; }
Property Value
- bool
true
if this instance is in a transaction; otherwise,false
.
IsSnapshot
Gets a value indicate whether this instance is a snapshot session.
bool IsSnapshot { get; }
Property Value
- bool
true
if the session is a snapshot session.
OperationTime
Gets the operation time.
BsonTimestamp OperationTime { get; }
Property Value
- BsonTimestamp
The operation time.
Options
Gets the session options.
CoreSessionOptions Options { get; }
Property Value
- CoreSessionOptions
The session options.
ServerSession
Gets the server session.
ICoreServerSession ServerSession { get; }
Property Value
- ICoreServerSession
The server session.
SnapshotTime
Gets the snapshot time.
BsonTimestamp SnapshotTime { get; }
Property Value
- BsonTimestamp
The snapshot time.
Methods
AbortTransaction(CancellationToken)
Aborts the transaction.
void AbortTransaction(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
AbortTransactionAsync(CancellationToken)
Aborts the transaction.
Task AbortTransactionAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A Task.
AboutToSendCommand()
The driver is about to send a command on this session. Called to track session state.
void AboutToSendCommand()
AdvanceClusterTime(BsonDocument)
Advances the cluster time.
void AdvanceClusterTime(BsonDocument newClusterTime)
Parameters
newClusterTime
BsonDocumentThe new cluster time.
AdvanceOperationTime(BsonTimestamp)
Advances the operation time.
void AdvanceOperationTime(BsonTimestamp newOperationTime)
Parameters
newOperationTime
BsonTimestampThe new operation time.
AdvanceTransactionNumber()
Advances the transaction id.
long AdvanceTransactionNumber()
Returns
- long
The transaction id.
CommitTransaction(CancellationToken)
Commits the transaction.
void CommitTransaction(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
CommitTransactionAsync(CancellationToken)
Commits the transaction.
Task CommitTransactionAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
A Task.
MarkDirty()
Marks the session as dirty.
void MarkDirty()
SetSnapshotTimeIfNeeded(BsonTimestamp)
Sets the snapshot time if not set.
void SetSnapshotTimeIfNeeded(BsonTimestamp snapshotTime)
Parameters
snapshotTime
BsonTimestampThe snapshot time.
StartTransaction(TransactionOptions)
Starts a transaction.
void StartTransaction(TransactionOptions transactionOptions = null)
Parameters
transactionOptions
TransactionOptionsThe transaction options.
WasUsed()
Called by the driver when the session is used (i.e. sent to the server).
void WasUsed()