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
'Declaration
<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 | |
---|---|---|
DataConnectionManager | Class constructor. |
Top
Properties
Name | Description | |
---|---|---|
Count | Retrieves a count of the number of data connections currently being managed. |
Top
Methods
Name | Description | |
---|---|---|
CopyTo | Copies the set of currently managed data connections to an array, starting at the specified array index. | |
CreateDataConnection | Initializes a data connection. This method should not be called by client code. | |
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.) | |
GetDataConnection(Guid, String, Boolean) | Retrieves a data connection that is equivalent to the specified connection information. | |
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. | |
GetHashCode | Serves as the default hash function. (Inherited from Object.) | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
InvalidateDataConnection | Invalidates a currently managed data connection that matches the specified connection information, if any. | |
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
Explicit Interface Implementations
Name | Description | |
---|---|---|
ICollection<DataConnection>.Add | Adds a data source to the DDEX data connection collection. | |
ICollection<DataConnection>.Clear | Clears the DDEX data connection collection. | |
ICollection<DataConnection>.Contains | Tests whether the DDEX data connection collection contains a specified connection. | |
IEnumerable<DataConnection>.GetEnumerator | Retrieves an enumerator for iterating the DDEX data connection collection. | |
IEnumerable.GetEnumerator | Retrieves an IEnumerator object with which to iterate through the collection. | |
ICollection<DataConnection>.IsReadOnly | Tests whether the data connection collection is read only. | |
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.