다음을 통해 공유


IVsDataProviderDynamicSupport.GetUnsupportedReason 메서드

이유는, 지정한 DDEX 데이터 원본에 대해 지원 되지 않는 작업을 설명 하는 지역화 된 문자열을 가져옵니다.

네임스페이스:  Microsoft.VisualStudio.Data.Core
어셈블리:  Microsoft.VisualStudio.Data.Core(Microsoft.VisualStudio.Data.Core.dll)

구문

‘선언
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

매개 변수

  • source
    형식: System.Guid
    DDEX 데이터 소스 식별자입니다.
  • context
    형식: System.Object
    작업에 존재 하는 컨텍스트를 나타내는 개체입니다.

반환 값

형식: System.String
작업이 실제로 지원 되지 않으면 지정한 작업이 지원 되지 않습니다 이유를 설명 하는 지역화 된 문자열입니다. 그렇지 않으면 nullNull 참조(Visual Basic의 경우 Nothing).

예외

예외 조건
ArgumentNullException

command 매개 변수가 nullNull 참조(Visual Basic의 경우 Nothing)입니다.

ArgumentException

context 매개 변수는 지정 된 작업에 대 한 예상 값입니다.

설명

이 메서드는 작업이 지원 되지 않는 이유가 돌아가려면 DDEX 공급자가 있습니다.DDEX 클라이언트이 따라서 사용자에 게 표시할 수 있습니다.

예제

다음 코드는 배포 명령을 데이터 탐색기에서 연결 노드에서 지원 되지 않는 경우 유용한 메시지를 반환 하도록이 메서드를 구현 하는 방법을 보여 줍니다.

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 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

IVsDataProviderDynamicSupport 인터페이스

Microsoft.VisualStudio.Data.Core 네임스페이스