IVsDataProviderDynamicSupport.IsSourceSupported Method
Gets a value indicating whether a particular DDEX data source is supported by this DDEX provider in the current environment.
Namespace: Microsoft.VisualStudio.Data.Core
Assembly: Microsoft.VisualStudio.Data.Core (in Microsoft.VisualStudio.Data.Core.dll)
Syntax
'Declaration
Function IsSourceSupported ( _
source As Guid _
) As Boolean
bool IsSourceSupported(
Guid source
)
bool IsSourceSupported(
Guid source
)
abstract IsSourceSupported :
source:Guid -> bool
function IsSourceSupported(
source : Guid
) : boolean
Parameters
source
Type: System.GuidA DDEX data source identifier.
Return Value
Type: System.Boolean
true if the DDEX data source is supported by this DDEX provider in the current environment; otherwise, false.
Remarks
This method enables DDEX providers to dynamically alter their availability of support for a particular DDEX data source 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.
When this method returns false, the IVsDataSourceManager service does not return the provider in its list of supported providers for the specified DDEX data source. If the data source ends up with no supporting providers, the data source is removed entirely.
Examples
The following code demonstrates how to implement this method so that it returns true only if a particular registry key exists, indicating that the appropriate runtime components are installed.
using System;
using System.ComponentModel.Design;
using Microsoft.Win32;
using Microsoft.VisualStudio.Data.Core;
public class MyProviderDynamicSupport3 : IVsDataProviderDynamicSupport
{
public bool IsProviderSupported
{
get
{
return true;
}
}
public bool IsSourceSupported(Guid source)
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Company\MyDatabaseSource");
if (key == null)
{
return false;
}
key.Close();
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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.