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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.