This topic has not yet been rated - Rate this topic

IVsDataSource Interface

Represents a DDEX data source.

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

The IVsDataSource type exposes the following members.

  NameDescription
Public propertyDefaultProviderGets the default provider that supports the DDEX data source.
Public propertyDescriptionGets the basic description of the DDEX data source.
Public propertyDisplayNameGets the display name of the DDEX data source.
Public propertyGuidGets the unique identifier of the DDEX data source.
Public propertyNameGets the programmatic name of the DDEX data source.
Top
  NameDescription
Public methodGetDescriptionGets a localized description of the selection of the DDEX data source combined with a specific supporting DDEX provider.
Public methodGetProperty(String)Gets a property of the DDEX data source.
Public methodGetProperty(Guid, String)Gets a property of the DDEX data source as registered by a specific supporting DDEX provider.
Public methodGetProvidersGets the DDEX providers that support this DDEX data source.
Top

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.

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);
        }
    }
}
Did you find this helpful?
(1500 characters remaining)

Community Additions

ADD
© 2013 Microsoft. All rights reserved.