ConnectionContext Class
Represents the context for the database connection that is associated with the database unit test.
Namespace: Microsoft.Data.Tools.Schema.Sql.UnitTesting
Assembly: Microsoft.Data.Tools.Schema.Sql.UnitTesting (in Microsoft.Data.Tools.Schema.Sql.UnitTesting.dll)
Inheritance Hierarchy
System.Object
Microsoft.Data.Tools.Schema.Sql.UnitTesting.ConnectionContext
Syntax
public class ConnectionContext : IDisposable
public ref class ConnectionContext : IDisposable
type ConnectionContext =
class
interface IDisposable
end
Public Class ConnectionContext
Implements IDisposable
Constructors
Name | Description | |
---|---|---|
ConnectionContext() | Initializes a new instance of the ConnectionContext class. |
Properties
Name | Description | |
---|---|---|
CommandTimeout | Gets or sets the time (in seconds) that elapses before the command that executes the batch statement times out. |
|
Connection | Gets or sets the database connection. |
|
Provider | Gets or sets a provider that is associated with the connection. |
|
Transaction | Gets or sets the transactions to use when executing the Transact-SQL statements. |
Methods
Name | Description | |
---|---|---|
Dispose() | Releases resources used by a connection. |
|
Dispose(Boolean) | Releases the unmanaged resources used by the connection and, optionally, releases the managed resources. |
|
Equals(Object) | (Inherited from Object.) |
|
Finalize() | (Inherited from Object.) |
|
GetHashCode() | (Inherited from Object.) |
|
GetType() | (Inherited from Object.) |
|
MemberwiseClone() | (Inherited from Object.) |
|
ToString() | (Inherited from Object.) |
Remarks
This class provides connection and execution information to the Execute method when the Transact-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. You must release the context in the Dispose method.
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
T:Microsoft.Data.Schema.UnitTesting.Configuration.ConnectionContextElement
Execute
Microsoft.Data.Tools.Schema.Sql.UnitTesting Namespace
Return to top