Table of Contents

Class Transaction

Namespace
MongoDB.Entities
Assembly
MongoDB.Entities.dll

Represents a DB instance that has a transaction started, which can be used to carry out inter-related write operations atomically.

TIP: Remember to always call .Dispose() after use or enclose in a 'Using' statement.

public class Transaction : DB, IDisposable
Inheritance
Transaction
Implements
Inherited Members

Properties

Session

The client session handle for this transaction instance.

public IClientSessionHandle Session { get; }

Property Value

IClientSessionHandle

Methods

AbortAsync(CancellationToken)

Aborts and rolls back a transaction

public Task AbortAsync(CancellationToken cancellation = default)

Parameters

cancellation CancellationToken

An optional cancellation token

Returns

Task

CommitAsync(CancellationToken)

Commits a transaction to MongoDB

public Task CommitAsync(CancellationToken cancellation = default)

Parameters

cancellation CancellationToken

An optional cancellation token

Returns

Task

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()