IVsDataProvider.SupportsObject Method (Guid, Type)
Determines whether a DDEX provider supports the specified type of DDEX support entity for the specified DDEX data source.
Namespace: Microsoft.VisualStudio.Data.Core
Assembly: Microsoft.VisualStudio.Data.Core (in Microsoft.VisualStudio.Data.Core.dll)
Syntax
'Declaration
Function SupportsObject ( _
source As Guid, _
objType As Type _
) As Boolean
bool SupportsObject(
Guid source,
Type objType
)
bool SupportsObject(
Guid source,
Type^ objType
)
abstract SupportsObject :
source:Guid *
objType:Type -> bool
function SupportsObject(
source : Guid,
objType : Type
) : boolean
Parameters
source
Type: System.GuidA DDEX data source identifier, or Empty for no specific data source.
objType
Type: System.TypeA type of DDEX support entity.
Return Value
Type: System.Boolean
true if the DDEX provider supports the specified type of DDEX support entity for the specified DDEX data source; otherwise, false.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The objType parameter is nulla null reference (Nothing in Visual Basic). |
Remarks
Determination of whether a DDEX provider supports a specified DDEX support entity is based on information that is added to the registry by the DDEX provider. This enables DDEX clients to inspect the capabilities of a given provider without having to load any provider code. This is useful when you are iterating through the set of providers to determine a filtered list of providers that support a particular set of support entities.
A DDEX provider adds various registry keys under a SupportedObjects key under their root registry key. These keys supply the names of each type of support entity that is supported. The key name must be a non-empty string without extraneous leading or trailing whitespace and must represent either an expandable or fully qualified type name of a support entity. An expandable support entity is an unqualified type name that is expanded to a fully qualified type name by prepending the Microsoft.VisualStudio.Data.Services.SupportEntities namespace. There are some special exceptions to this. These exceptions include the IVsDataProviderDynamicSupport and IVsDataSourceSpecializer support entities, which are prepended with the Microsoft.VisualStudio.Data.Core namespace.
Note
DDEX in Visual Studio 2005 reads registry keys that identify support entity types in the Microsoft.VisualStudio.Data assembly. DDEX in Visual Studio 2008 still reads these registry keys for compatibility purposes and maps the old support entity types into the new ones. For example, a call to the SupportsObject method for a Visual Studio 2005 DDEX provider with the IVsDataConnectionProperties type will return true if the provider registered the old DataConnectionProperties support entity type.
In addition to these support entity registry keys, a DDEX provider can add subkeys under a given support entity key that represent specific DDEX data sources for which the support entity is supported. If no such subkeys exist, the support entity is assumed to be supported for all DDEX data sources. If one or more subkeys exist, the support entity is assumed to be supported for only the specified DDEX data sources. If a support entity has both a standard implementation for nonspecific DDEX data sources in addition to implementations for specific DDEX data sources, there must be a subkey with an empty GUID. There must also be subkeys for specific DDEX data sources. If any subkey is not a valid GUID, it is ignored.
If the specified support entity type is defined to have a default implementation, this method always returns true.
Examples
The following code demonstrates how to identify whether a specified DDEX provider supports a method for connecting to a specified data source in the context of a connection UI.
using System;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Data.Services.SupportEntities;
public class DDEX_IVsDataProviderExample9
{
public static bool HasSpecialConnectForUI(
IVsDataProvider provider, Guid source)
{
return provider.SupportsObject(
source, typeof(IVsDataConnectionUIConnector));
}
}
.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.