Share via


TransactionManager.BeginTransaction Method (String, Boolean, TransactionContext)

Creates a new transaction object with a given name and returns a reference to it

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.11.0 (in Microsoft.VisualStudio.Modeling.Sdk.11.0.dll)

Syntax

'Declaration
Public Function BeginTransaction ( _
    name As String, _
    isSerializing As Boolean, _
    context As TransactionContext _
) As Transaction
public Transaction BeginTransaction(
    string name,
    bool isSerializing,
    TransactionContext context
)
public:
Transaction^ BeginTransaction(
    String^ name, 
    bool isSerializing, 
    TransactionContext^ context
)
member BeginTransaction : 
        name:string * 
        isSerializing:bool * 
        context:TransactionContext -> Transaction
public function BeginTransaction(
    name : String, 
    isSerializing : boolean, 
    context : TransactionContext
) : Transaction

Parameters

  • name
    Type: String

    The transaction name.

  • isSerializing
    Type: Boolean

    Determines the value of transaction.IsSerializing. true indicates that the model is being read from file.

Return Value

Type: Microsoft.VisualStudio.Modeling.Transaction
A Transaction object.

Remarks

Use this version if you have written rules and event handlers that use information passed in a transaction context object. Because rules are called in an arbitrary order at the end of a transaction, it is not possible to pass information to or between them directly. The transaction context is a dictionary in which any kind of information can be passed.

Examples

// In a rule:
UsefulInfo info = this.Store.TransactionManager.CurrentTransaction
    .TopLevelTransaction.Context.ContextInfo["akey"] as UsefulInfo;

.NET Framework Security

See Also

Reference

TransactionManager Class

BeginTransaction Overload

Microsoft.VisualStudio.Modeling Namespace