IVsDataProviderDynamicSupport.IsOperationSupported 메서드

작업별 DDEX 지정한 데이터 원본에 대 한 현재 환경에서 지원 되는지 여부를 결정 합니다.

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

구문

‘선언
Function IsOperationSupported ( _
    source As Guid, _
    command As CommandID, _
    context As Object _
) As Boolean
bool IsOperationSupported(
    Guid source,
    CommandID command,
    Object context
)
bool IsOperationSupported(
    Guid source, 
    CommandID^ command, 
    Object^ context
)
abstract IsOperationSupported : 
        source:Guid * 
        command:CommandID * 
        context:Object -> bool
function IsOperationSupported(
    source : Guid, 
    command : CommandID, 
    context : Object
) : boolean

매개 변수

  • source
    형식: Guid

    DDEX 데이터 소스 식별자입니다.

  • command
    형식: CommandID

    연산을 식별 하는 명령입니다.

  • context
    형식: Object

    작업에 존재 하는 컨텍스트를 나타내는 개체입니다.

반환 값

형식: Boolean
true 작업 공급자는 현재 환경에서 지원 되지 않는 경우. 그렇지 않으면 false.

예외

예외 조건
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 네임스페이스