Share via


IVsDataProviderDynamicSupport.IsProviderSupported Property

Gets a value indicating whether the provider is supported in the current environment.

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

Syntax

'Declaration
ReadOnly Property IsProviderSupported As Boolean
bool IsProviderSupported { get; }
property bool IsProviderSupported {
    bool get ();
}
abstract IsProviderSupported : bool with get
function get IsProviderSupported () : boolean

Property Value

Type: System.Boolean
A value indicating whether the provider is supported in the current environment.

Remarks

This property enables DDEX providers to dynamically alter their availability in Visual Studio, beyond simply being installed or not installed on the computer. This can be useful when the DDEX provider depends on or targets a particular technology (for example, a runtime ADO.NET provider) that can be installed separately or independently. It allows the DDEX provider to make itself unavailable when the required components are not installed.

When this property returns false, the IVsDataProviderManager service does not return the existence of this provider. This is equivalent to the provider not being installed.

Examples

The following code demonstrates how to implement this method so that it returns true only if a particular registry key exists, which indicates that the appropriate runtime components are installed.

using System;
using System.ComponentModel.Design;
using Microsoft.Win32;
using Microsoft.VisualStudio.Data.Core;

internal class MyProviderDynamicSupport : IVsDataProviderDynamicSupport
{
    public bool IsProviderSupported
    {
        get
        {
            RegistryKey key = Registry.LocalMachine.OpenSubKey(
                @"SOFTWARE\Company\AdoDotNetProvider");
            if (key == null)
            {
                return false;
            }
            key.Close();
            return true;
        }
    }

    public bool IsSourceSupported(Guid source)
    {
        return true;
    }

    public bool IsOperationSupported(
        Guid source, CommandID command, object context)
    {
        return true;
    }

    public string GetUnsupportedReason(
        Guid source, CommandID command, object context)
    {
        return null;
    }
}

.NET Framework Security

See Also

Reference

IVsDataProviderDynamicSupport Interface

Microsoft.VisualStudio.Data.Core Namespace