다음을 통해 공유


DataConnectionManager Class

Represents a shared set of data connection objects that are created on demand and managed by Visual Studio.

Inheritance Hierarchy

System.Object
  Microsoft.VisualStudio.Data.DataConnectionManager

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

Syntax

‘선언
<GuidAttribute("E7A0D4E0-D0E4-4afa-A8A1-DD4636073D98")> _
Public MustInherit Class DataConnectionManager _
    Implements ICollection(Of DataConnection), IEnumerable(Of DataConnection),  _
    IEnumerable
[GuidAttribute("E7A0D4E0-D0E4-4afa-A8A1-DD4636073D98")]
public abstract class DataConnectionManager : ICollection<DataConnection>, 
    IEnumerable<DataConnection>, IEnumerable
[GuidAttribute(L"E7A0D4E0-D0E4-4afa-A8A1-DD4636073D98")]
public ref class DataConnectionManager abstract : ICollection<DataConnection^>, 
    IEnumerable<DataConnection^>, IEnumerable
[<AbstractClass>]
[<GuidAttribute("E7A0D4E0-D0E4-4afa-A8A1-DD4636073D98")>]
type DataConnectionManager =  
    class
        interface ICollection<DataConnection>
        interface IEnumerable<DataConnection>
        interface IEnumerable
    end
public abstract class DataConnectionManager implements ICollection<DataConnection>, IEnumerable<DataConnection>, IEnumerable

The DataConnectionManager type exposes the following members.

Constructors

  Name Description
Protected method DataConnectionManager Class constructor.

Top

Properties

  Name Description
Public property Count Retrieves a count of the number of data connections currently being managed.

Top

Methods

  Name Description
Public method CopyTo Copies the set of currently managed data connections to an array, starting at the specified array index.
Protected method CreateDataConnection Initializes a data connection. This method should not be called by client code.
Public method Equals Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected method Finalize Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.)
Public method GetDataConnection(Guid, String, Boolean) Retrieves a data connection that is equivalent to the specified connection information.
Public method GetDataConnection(Guid, String, Boolean, Boolean) Retrieves a data connection that is equivalent to the specified connection information, with an indication whether the connection information is updated.
Public method GetHashCode Serves as a hash function for a particular type. (Inherited from Object.)
Public method GetType Gets the Type of the current instance. (Inherited from Object.)
Public method InvalidateDataConnection Invalidates a currently managed data connection that matches the specified connection information, if any.
Protected method MemberwiseClone Creates a shallow copy of the current Object. (Inherited from Object.)
Public method ToString Returns a string that represents the current object. (Inherited from Object.)

Top

Explicit Interface Implementations

  Name Description
Explicit interface implemetationPrivate method ICollection<DataConnection>.Add Adds a data source to the DDEX data connection collection.
Explicit interface implemetationPrivate method ICollection<DataConnection>.Clear Clears the DDEX data connection collection.
Explicit interface implemetationPrivate method ICollection<DataConnection>.Contains Tests whether the DDEX data connection collection contains a specified connection.
Explicit interface implemetationPrivate method IEnumerable<DataConnection>.GetEnumerator Retrieves an enumerator for iterating the DDEX data connection collection.
Explicit interface implemetationPrivate method IEnumerable.GetEnumerator Retrieves an IEnumerator object with which to iterate through the collection.
Explicit interface implemetationPrivate property ICollection<DataConnection>.IsReadOnly Tests whether the data connection collection is read only.
Explicit interface implemetationPrivate method ICollection<DataConnection>.Remove Removes a data connection from the DDEX data connection collection.

Top

Remarks

Because the architecture of VSPackages and the Visual Studio services model, it is difficult to pass around objects, such as data connections, that one would typically use globally. Normally, an application makes a single connection to a database and then use it throughout. In Visual Studio different features are implemented in different VSPackages, therefore, the only way to connect features is by using Visual Studio services.

If one feature, for example the Server Explorer, creates a connection for use at design time, and another feature, for example the Data Source Wizard or DataSet designer, wants to use this connection, they need a way to access the connection that was created in Server Explorer.

The data connection manager lets you share these connections, so long as the client has a way to identify the connection. This identifying information is a DDEX provider GUID and a connection string.

A typical data connection manager scenario is implementing drag/drop operations, where the clipboard object is created with the DDEX provider and connection string information and the code accepting the drop uses this information to look up a matching connection.

A designer is typically expected to pass around DDEX provider and connection string information; then, when it needs to use a connection for design time purposes, it calls into the data connection manager to retrieve a connection given the information

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

DataConnection

DataConnectionFactory