Share via


IVsDataSource Interface

Represents a DDEX data source.

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

Syntax

'Declaration
Public Interface IVsDataSource
public interface IVsDataSource
public interface class IVsDataSource
type IVsDataSource =  interface end
public interface IVsDataSource

The IVsDataSource type exposes the following members.

Properties

  Name Description
Public property DefaultProvider Gets the default provider that supports the DDEX data source.
Public property Description Gets the basic description of the DDEX data source.
Public property DisplayName Gets the display name of the DDEX data source.
Public property Guid Gets the unique identifier of the DDEX data source.
Public property Name Gets the programmatic name of the DDEX data source.

Top

Methods

  Name Description
Public method GetDescription Gets a localized description of the selection of the DDEX data source combined with a specific supporting DDEX provider.
Public method GetProperty(String) Gets a property of the DDEX data source.
Public method GetProperty(Guid, String) Gets a property of the DDEX data source as registered by a specific supporting DDEX provider.
Public method GetProviders Gets the DDEX providers that support this DDEX data source.

Top

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

Microsoft.VisualStudio.Data.Core Namespace