DataConnection Class
Supports a connection to a data source.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Data.ServiceProvider
Microsoft.VisualStudio.Data.DataConnection
Namespace: Microsoft.VisualStudio.Data
Assembly: Microsoft.VisualStudio.Data (in Microsoft.VisualStudio.Data.dll)
Syntax
'Declaration
Public MustInherit Class DataConnection _
Inherits ServiceProvider _
Implements ICloneable, IDisposable
public abstract class DataConnection : ServiceProvider,
ICloneable, IDisposable
public ref class DataConnection abstract : public ServiceProvider,
ICloneable, IDisposable
[<AbstractClass>]
type DataConnection =
class
inherit ServiceProvider
interface ICloneable
interface IDisposable
end
public abstract class DataConnection extends ServiceProvider implements ICloneable, IDisposable
The DataConnection type exposes the following members.
Constructors
Name | Description | |
---|---|---|
DataConnection | Class constructor. Instantiates a new instance of the DataConnection class. |
Top
Properties
Name | Description | |
---|---|---|
AsyncCommand | Retrieves an object that can perform asynchronous derivation and execution of commands on the data source. | |
Command | Retrieves an object that can perform derivation and execution of commands on the data source. | |
ConnectionSupport | Retrieves the underlying data provider connection support object that is being used to support the current data connection instance. | |
ConnectionTimeout | Retrieves or sets the amount of time, in seconds, before a command to open a connection times out. | |
DisplayConnectionString | Retrieves or sets unencrypted connection information in the form of a DDEX-provider-specific string. | |
EncryptedConnectionString | Retrieves or sets encrypted connection information in the form of a DPAPI-encrypted, provider-specific string. | |
IsLockedForExclusiveAccess | Retrieves a Boolean value indicating whether the current connection is locked by a client for exclusive access. | |
ObjectChangeEvents | Retrieves an object that provides a set of events raised when data objects on the data source are added, changed, or removed. | |
ObjectIdentifierConverter | Retrieves an object that can convert data object identifiers from formatted strings to unformatted parts and vice versa. | |
ObjectIdentifierResolver | Retrieves an object that can resolve data object identifiers through both expansion and contraction. | |
ObjectItemComparer | Retrieves an object that can compare identifier parts and properties on data objects. | |
ObjectSupport | Retrieves an object that provides an XML stream defining the various DDEX data object types supported by the current data connection. | |
Provider | Retrieves the unique identifier of the DDEX Provider for the current data connection. | |
ProviderObjectIsLocked | Retrieves a Boolean value indicating whether the underlying DDEX Provider object is locked for use by a client. | |
ServiceTypes | Retrieves a list of service types used to convert the unmanaged QueryService method call, in which a service GUID is specified, into a managed IServiceProvider.GetService method call, in which a managed type is specified. (Inherited from ServiceProvider.) | |
Source | Retrieves the globally unique identifier (GUID) of the data source for the current data connection, if any. | |
SourceInformation | Retrieves an object that provides a set of well known name/value pairs describing the characteristics of the data source. | |
SourceVersionComparer | Retrieves an object that allows you to compare data-source-specific version numbers. | |
State | Retrieves the current state of this data connection. | |
Transaction | Retrieves an object that enables transaction processing; that is, allows you to begin, commit, and rollback transactions on the data source. | |
ViewSupport | Retrieves an object that provides an XML stream defining the various data views supported by the current data connection. |
Top
Methods
Name | Description | |
---|---|---|
Clone | Creates a cloned instance of this data connection, which retains the same connection properties and state as the original. | |
Close | Closes the current data connection. | |
Dispose() | Disposes of the current data connection and all its associated resources. | |
Dispose(Boolean) | Supports the DDEX infrastructure and is not intended to be used directly from your code. | |
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
EquivalentTo | Retrieves a Boolean value indicating whether or not information about the current connection is equivalent, in a design time sense, to the specified connection information. | |
Finalize | Finalizes the connection. (Overrides Object.Finalize().) | |
GetExclusiveAccessProxy | Retrieves a proxy instance that allows the caller exclusive access to the data connection. | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetLockedProviderObject() | Retrieves the underlying data provider object, if any, which supports the current data connection. | |
GetLockedProviderObject(Int32) | Retrieves the underlying data provider object, if any, which supports the current data connection. | |
GetService(Guid) | Retrieves a service with a specified service GUID. (Inherited from ServiceProvider.) | |
GetService(Type) | Retrieves a service of the specified type. (Inherited from ServiceProvider.) | |
GetServiceImpl(Guid) | Provides the implementation for retrieving a service with a specific GUID. (Inherited from ServiceProvider.) | |
GetServiceImpl(Type) | Provides the implementation for retrieving a service of a specific type. (Inherited from ServiceProvider.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
OnMessageReceived | Handler for the MessageReceived event. | |
OnStateChanged | Handler for the StateChanged event. | |
Open | Opens this data connection. | |
ReleaseExclusiveAccessProxy | Releases an existing exclusive access proxy, as provided with a call to the GetExclusiveAccessProxy method. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) | |
UnlockProviderObject | Unlocks a DDEX Provider object that has been locked using a call to the GetLockedProviderObjectmethod. |
Top
Events
Name | Description | |
---|---|---|
MessageReceived | Event that is raised when a message is received from the data source. | |
StateChanged | Event that is raised when the state of the data connection has changed. |
Top
Explicit Interface Implementations
Name | Description | |
---|---|---|
ICloneable.Clone | Creates a new connection object instance that is a copy of the current instance. | |
IServiceProvider.QueryService | Performs as a factory for services that are exposed through an implementation of IServiceProvider. (Inherited from ServiceProvider.) |
Top
Remarks
This class provides basic communication with a data source, supporting capabilities such as opening and closing connections. It also provides access to a set of services that expose more specific functionality against the data source.
DDEX provides the single implementation of this class; no data provider should provide their own implementation of the DataConnection class. Instead, DDEX Providers should implement the DataConnectionSupportclass, which is then wrapped by the DataConnection instance.
The benefit of this approach is that it allows DDEX to provide a key feature to both client and data provider: locking of the connection so that multiple clients can share the same connection and yet not create conflicts. With this architecture, clients do not need to worry about conflicting with one another, and data providers do not need to worry about multithreaded access.
The DataConnection class achieves this level of locking by serving as a proxy object for the DataConnectionSupportclass instance, as well as by providing proxy objects for each known DDEX service available from the connection. These proxies implement each method and property by locking the connection, then calling the data provider's implementation, then unlocking the connection.
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.