Delen via


ConnectionContext.Transaction Property

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

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

Syntax

'Declaration
Public Property Transaction As DbTransaction
public DbTransaction Transaction { get; set; }
public:
property DbTransaction^ Transaction {
    DbTransaction^ get ();
    void set (DbTransaction^ value);
}
member Transaction : DbTransaction with get, set
function get Transaction () : DbTransaction
function set Transaction (value : 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.

.NET Framework Security

See Also

Reference

ConnectionContext Class

Microsoft.Data.Schema.UnitTesting Namespace

DbTransaction