Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Gets a localized string describing the reason an operation is not supported, 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 GetUnsupportedReason ( _
source As Guid, _
command As CommandID, _
context As Object _
) As String
string GetUnsupportedReason(
Guid source,
CommandID command,
Object context
)
String^ GetUnsupportedReason(
Guid source,
CommandID^ command,
Object^ context
)
abstract GetUnsupportedReason :
source:Guid *
command:CommandID *
context:Object -> string
function GetUnsupportedReason(
source : Guid,
command : CommandID,
context : Object
) : String
Parameters
- source
Type: System.Guid
A DDEX data source identifier.
- command
Type: System.ComponentModel.Design.CommandID
A command identifying the operation.
- context
Type: System.Object
An object representing the context in which the operation exists.
Return Value
Type: System.String
A localized string describing why the specified operation is not supported, if the operation is in fact not supported; otherwise, nulla null reference (Nothing in Visual Basic).
Exceptions
| Exception | Condition |
|---|---|
| ArgumentNullException | The command parameter is nulla null reference (Nothing in Visual Basic). |
| ArgumentException | The context parameter is not an expected value for the specified operation. |
Remarks
This method enables DDEX providers to return a specific reason that an operation is not supported. DDEX clients can display this reason to the user.
Examples
The following code demonstrates how to implement this method to return a useful message when a Deploy command on a connection node in the data explorer is not supported.
using System;
using System.ComponentModel.Design;
using Microsoft.Win32;
using Microsoft.VisualStudio.Data.Core;
using Microsoft.VisualStudio.Data.Services;
public class MyProviderDynamicSupport2 : IVsDataProviderDynamicSupport
{
private static readonly CommandID DeployCommand =
new CommandID(new Guid("6535F307-2083-4cbb-B2FA-11F2DCD69DAF"), 25);
public bool IsProviderSupported
{
get
{
return true;
}
}
public bool IsSourceSupported(Guid source)
{
return true;
}
public bool IsOperationSupported(
Guid source, CommandID command, object context)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
if (command.Equals(DeployCommand))
{
IVsDataExplorerConnection explorerConnection =
context as IVsDataExplorerConnection;
if (explorerConnection == null)
{
throw new ArgumentException();
}
RegistryKey key = Registry.LocalMachine.OpenSubKey(
@"SOFTWARE\Company\DeployTechnology");
if (key == null)
{
return false;
}
key.Close();
}
return true;
}
public string GetUnsupportedReason(
Guid source, CommandID command, object context)
{
if (command == null)
{
throw new ArgumentNullException("command");
}
if (command.Equals(DeployCommand) &&
!IsOperationSupported(source, command, context))
{
// Note: This string should be localized
return "In order to deploy a database you need to install our deployment technology.";
}
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.