ConnectionContext.Transaction Property

 

Gets or sets the transactions to use when executing the Transact-SQL statements.

Namespace:   Microsoft.Data.Tools.Schema.Sql.UnitTesting
Assembly:  Microsoft.Data.Tools.Schema.Sql.UnitTesting (in Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll)

Syntax

public DbTransaction Transaction { get; set; }
public:
property DbTransaction^ Transaction {
    DbTransaction^ get();
    void set(DbTransaction^ value);
}
member Transaction : DbTransaction with get, set
Public Property Transaction As DbTransaction

Property Value

Type: System.Data.Common.DbTransaction

The transaction for the current unit test.

Remarks

Use this property to modify the generated test code to run in the scope of a single transaction. For example, create, update, and delete application tests change the database state. However, you can prevent one test's operations from affecting the execution of another test by executing your test within the scope of a single transaction. After the test is complete and verified, you can roll back the transaction.

See Also

DbTransaction
ConnectionContext Class
Microsoft.Data.Tools.Schema.Sql.UnitTesting Namespace

Return to top