Partager via


IVsDataSourceManager Interface

Represents the DDEX Data Source Manager service, which enables discovery of registered DDEX data sources.

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

Syntax

'Déclaration
<GuidAttribute("32E0C769-C2C9-4587-B58C-013266137571")> _
Public Interface IVsDataSourceManager
[GuidAttribute("32E0C769-C2C9-4587-B58C-013266137571")]
public interface IVsDataSourceManager
[GuidAttribute(L"32E0C769-C2C9-4587-B58C-013266137571")]
public interface class IVsDataSourceManager
[<GuidAttribute("32E0C769-C2C9-4587-B58C-013266137571")>]
type IVsDataSourceManager =  interface end
public interface IVsDataSourceManager

The IVsDataSourceManager type exposes the following members.

Properties

  Name Description
Public property Sources Gets a dictionary of all registered DDEX data sources.

Top

Remarks

DDEX providers register the data sources they support for a particular installation of Visual Studio by adding specific registry keys in the Visual Studio local registry hive. The DDEX Data Source Manager service enumerates these data sources and supplies the list of registered data sources to the caller. It also performs additional work to ensure that each data source is registered correctly. Information about data sources that are not registered correctly is logged in the Windows event log, and the data source is not returned to the caller. The following registration characteristics are verified by this service:

  • The data source registry key under the DataSources key is a valid GUID consisting of 32 digits separated by hyphens, enclosed in brackets ({xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}).

  • The DefaultProvider registry value, if specified, is a valid GUID.

  • The subkeys listed under the SupportingProviders key, if specified, are all valid GUIDs.

  • If a default provider is specified, it is listed under the SupportingProviders key.

  • At least one of the providers listed under the SupportingProviders key is a valid, registered DDEX provider.

Note that certain editions of Visual Studio restrict which data sources are available. For example, the Express editions allow only a small subset of the Microsoft DDEX data sources. These restrictions are for business purposes and override any entries that may have been added in addition to those data sources that are allowed by the edition. A given DDEX provider may dynamically determine whether it supports the data source under the current environment by implementing the IVsDataProviderDynamicSupport support entity. If a data source is determined to be unsupported by the edition or current environment, it is not returned by this service.

The DDEX Data Source Manager service is a global Visual Studio service that is registered with the environment. Therefore, you can access it by requesting the service from a global service provider object.

Examples

The following code demonstrates how a client can retrieve the DDEX Source Manager service from a global Visual Studio service provider and enumerate the set of DDEX data sources registered in the environment.

using System;
using System.Diagnostics;
using Microsoft.VisualStudio.Data.Core;

public class DDEX_IVsDataSourceManagerExample1
{
    public static void EnumerateDataSources(IServiceProvider serviceProvider)
    {
        IVsDataSourceManager sourceManager =
            serviceProvider.GetService(typeof(IVsDataSourceManager))
                as IVsDataSourceManager;
        foreach (IVsDataSource source in sourceManager.Sources.Values)
        {
            Trace.WriteLine(source.DisplayName);
        }
    }
}

See Also

Reference

Microsoft.VisualStudio.Data.Core Namespace