Partager via


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
Protected method DataConnection Class constructor. Instantiates a new instance of the DataConnection class.

Top

Properties

  Name Description
Public property AsyncCommand Retrieves an object that can perform asynchronous derivation and execution of commands on the data source.
Public property Command Retrieves an object that can perform derivation and execution of commands on the data source.
Public property ConnectionSupport Retrieves the underlying data provider connection support object that is being used to support the current data connection instance.
Public property ConnectionTimeout Retrieves or sets the amount of time, in seconds, before a command to open a connection times out.
Public property DisplayConnectionString Retrieves or sets unencrypted connection information in the form of a DDEX-provider-specific string.
Public property EncryptedConnectionString Retrieves or sets encrypted connection information in the form of a DPAPI-encrypted, provider-specific string.
Public property IsLockedForExclusiveAccess Retrieves a Boolean value indicating whether the current connection is locked by a client for exclusive access.
Public property ObjectChangeEvents Retrieves an object that provides a set of events raised when data objects on the data source are added, changed, or removed.
Public property ObjectIdentifierConverter Retrieves an object that can convert data object identifiers from formatted strings to unformatted parts and vice versa.
Public property ObjectIdentifierResolver Retrieves an object that can resolve data object identifiers through both expansion and contraction.
Public property ObjectItemComparer Retrieves an object that can compare identifier parts and properties on data objects.
Public property ObjectSupport Retrieves an object that provides an XML stream defining the various DDEX data object types supported by the current data connection.
Public property Provider Retrieves the unique identifier of the DDEX Provider for the current data connection.
Public property ProviderObjectIsLocked Retrieves a Boolean value indicating whether the underlying DDEX Provider object is locked for use by a client.
Protected property 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.)
Public property Source Retrieves the globally unique identifier (GUID) of the data source for the current data connection, if any.
Public property SourceInformation Retrieves an object that provides a set of well known name/value pairs describing the characteristics of the data source.
Public property SourceVersionComparer Retrieves an object that allows you to compare data-source-specific version numbers.
Public property State Retrieves the current state of this data connection.
Public property Transaction Retrieves an object that enables transaction processing; that is, allows you to begin, commit, and rollback transactions on the data source.
Public property ViewSupport Retrieves an object that provides an XML stream defining the various data views supported by the current data connection.

Top

Methods

  Name Description
Public method Clone Creates a cloned instance of this data connection, which retains the same connection properties and state as the original.
Public method Close Closes the current data connection.
Public method Dispose() Disposes of the current data connection and all its associated resources.
Protected method Dispose(Boolean) Supports the DDEX infrastructure and is not intended to be used directly from your code.
Public method Equals Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public method 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.
Protected method Finalize Finalizes the connection. (Overrides Object.Finalize().)
Public method GetExclusiveAccessProxy Retrieves a proxy instance that allows the caller exclusive access to the data connection.
Public method GetHashCode Serves as the default hash function. (Inherited from Object.)
Public method GetLockedProviderObject() Retrieves the underlying data provider object, if any, which supports the current data connection.
Public method GetLockedProviderObject(Int32) Retrieves the underlying data provider object, if any, which supports the current data connection.
Public method GetService(Guid) Retrieves a service with a specified service GUID. (Inherited from ServiceProvider.)
Public method GetService(Type) Retrieves a service of the specified type. (Inherited from ServiceProvider.)
Protected method GetServiceImpl(Guid) Provides the implementation for retrieving a service with a specific GUID. (Inherited from ServiceProvider.)
Protected method GetServiceImpl(Type) Provides the implementation for retrieving a service of a specific type. (Inherited from ServiceProvider.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Protected method OnMessageReceived Handler for the MessageReceived event.
Protected method OnStateChanged Handler for the StateChanged event.
Public method Open Opens this data connection.
Public method ReleaseExclusiveAccessProxy Releases an existing exclusive access proxy, as provided with a call to the GetExclusiveAccessProxy method.
Public method ToString Returns a string that represents the current object. (Inherited from Object.)
Public method UnlockProviderObject Unlocks a DDEX Provider object that has been locked using a call to the GetLockedProviderObjectmethod.

Top

Events

  Name Description
Public event MessageReceived Event that is raised when a message is received from the data source.
Public event StateChanged Event that is raised when the state of the data connection has changed.

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method ICloneable.Clone Creates a new connection object instance that is a copy of the current instance.
Explicit interface implemetationPrivate method 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.

See Also

Reference

Microsoft.VisualStudio.Data Namespace

ICloneable

IDisposable