Share via


ConnectionContext Class

Establishes the context for the database connection that is associated with the database unit test.

Namespace:  Microsoft.VisualStudio.TeamSystem.Data.UnitTesting
Assembly:  Microsoft.VisualStudio.TeamSystem.Data.UnitTesting (in Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.dll)

Syntax

'Declaration
Public Class ConnectionContext _
    Implements IDisposable
'Usage
Dim instance As ConnectionContext
public class ConnectionContext : IDisposable
public ref class ConnectionContext : IDisposable
public class ConnectionContext implements IDisposable

Remarks

The ConnectionContext class provides connection and execution information to the Execute(ConnectionContext, String, array<DbParameter[]) method when the Transact-SQL (T-SQL) is executed. ConnectionContext uses types in the System.Data.Common namespace, regardless of database type.

Use this type to store the state of an open connection for later use. For example, you can save the impersonation context from an open connection if you want to use the same connection string and Windows authentication with two sets of Windows credentials. For more information, see Impersonate. In the Dispose method, you need to release the context.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.TeamSystem.Data.UnitTesting.ConnectionContext

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ConnectionContext Members

Microsoft.VisualStudio.TeamSystem.Data.UnitTesting Namespace