Class Transaction
Represents a transaction used to carry out inter-related write operations.
TIP: Remember to always call .Dispose() after use or enclose in a 'Using' statement.
IMPORTANT: Use the methods on this transaction to perform operations and not the methods on the DB class.
Implements
Inherited Members
Namespace: MongoDB.Entities
Assembly: MongoDB.Entities.dll
Syntax
public class Transaction : DBContext, IDisposable
Constructors
Transaction(String, ClientSessionOptions, ModifiedBy)
Instantiates and begins a transaction.
Declaration
public Transaction(string database = null, ClientSessionOptions options = null, ModifiedBy modifiedBy = null)
Parameters
Type | Name | Description |
---|---|---|
String | database | The name of the database to use for this transaction. default db is used if not specified |
ClientSessionOptions | options | Client session options for this transaction |
ModifiedBy | modifiedBy | An optional ModifiedBy instance. When supplied, all save/update operations performed via this DBContext instance will set the value on entities that has a property of type ModifiedBy. You can inherit from the ModifiedBy class and add your own properties to it. Only one ModifiedBy property is allowed on a single entity type. |
Methods
Dispose()
Declaration
public void Dispose()
Dispose(Boolean)
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing |