IVsDataSource Interface

Represents a DDEX data source.

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

Syntax

Public Interface IVsDataSource

Dim instance As IVsDataSource
public interface IVsDataSource
public interface class IVsDataSource
public interface IVsDataSource

Remarks

A DDEX data source object supplies information about a data source that is registered in the Visual Studio environment. Each data source has a unique GUID that distinguishes it from all others, in addition to various names and descriptions. This interface supplies information that maps the data source to the DDEX providers that support the data source and also to a set of properties that can define custom characteristics of the data source.

You can retrieve a DDEX data source object by using the IVsDataSourceManager service.

Examples

The following code demonstrates how a client can retrieve a specific DDEX data source and output its display name, its description, and the names of each supporting provider.

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

public class DDEX_IVsDataSourceExample1
{
    public static void OutputDataSource(
        IServiceProvider serviceProvider,
        Guid dataSourceGuid)
    {
        IVsDataSourceManager sourceManager =
            serviceProvider.GetService(typeof(IVsDataSourceManager))
                as IVsDataSourceManager;
        IVsDataSource source = sourceManager.Sources[dataSourceGuid];
        Trace.WriteLine(source.DisplayName);
        Trace.WriteLine(source.Description);
        IVsDataProviderManager providerManager =
            serviceProvider.GetService(typeof(IVsDataProviderManager))
                as IVsDataProviderManager;
        foreach (Guid providerGuid in source.GetProviders())
        {
            IVsDataProvider provider = providerManager.Providers[providerGuid];
            Trace.WriteLine(provider.Name);
        }
    }
}

See Also

Reference

IVsDataSource Members

Microsoft.VisualStudio.Data.Core Namespace