ConnectionContext Class
Represents the context for the database connection that is associated with the database unit test.
Inheritance Hierarchy
System.Object
Microsoft.Data.Schema.UnitTesting.ConnectionContext
Namespace: Microsoft.Data.Schema.UnitTesting
Assembly: Microsoft.Data.Schema.UnitTesting (in Microsoft.Data.Schema.UnitTesting.dll)
Syntax
'Declaration
Public Class ConnectionContext _
Implements IDisposable
public class ConnectionContext : IDisposable
public ref class ConnectionContext : IDisposable
type ConnectionContext =
class
interface IDisposable
end
public class ConnectionContext implements IDisposable
The ConnectionContext type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ConnectionContext | Initializes a new instance of the ConnectionContext class. |
Top
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. |
Top
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 | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
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.