IDTSVirtualInput100.SetUsageType(Int32, DTSUsageType) 메서드

정의

가상 입력 열 개체를 매핑하고 해당 사용 유형을 설정합니다.

public:
 int SetUsageType(int lLineageID, Microsoft::SqlServer::Dts::Pipeline::Wrapper::DTSUsageType eUsageType);
[System.Runtime.InteropServices.DispId(104)]
public int SetUsageType (int lLineageID, Microsoft.SqlServer.Dts.Pipeline.Wrapper.DTSUsageType eUsageType);
[<System.Runtime.InteropServices.DispId(104)>]
abstract member SetUsageType : int * Microsoft.SqlServer.Dts.Pipeline.Wrapper.DTSUsageType -> int
Public Function SetUsageType (lLineageID As Integer, eUsageType As DTSUsageType) As Integer

매개 변수

lLineageID
Int32

매핑되는 LineageIDIDTSVirtualInputColumn100입니다.

eUsageType
DTSUsageType

입력 열이 구성 요소에서 사용되는 방식을 나타내는 DTSUsageType 열거형의 값입니다.

반환

새로 만들어진 IDTSInputColumn100의 인덱스이거나, eUsageTypeUT_IGNORED이고 열이 입력 열 컬렉션에서 제거된 경우 -1입니다.

특성

예제

다음 코드 예제에서는 가상 입력을 사용하여 입력 컬렉션에서 열을 추가하고 제거하는 구성 요소의 재정의 SetUsageType 된 구현 SetUsageType 을 보여 줍니다. 이 예제에서는 구성 요소에서 열을 쓸 수 없으므로 가 UT_READWRITE 예외가 발생하는 경우 eUsageType 입니다.

public override IDTSInputColumn100 SetUsageType(int inputID, IDTSVirtualInput100 virtualInput, int lineageID, DTSUsageType usageType)  
{  
    // Prevent use of read/write columns.  
    if (usageType == DTSUsageType.UT_READWRITE)  
        throw new Exception("Read write columns prohibited.");  

    // Get the input specified by inputID.  
    IDTSInput100 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);  

    int index = virtualInput.SetUsageType(lineageID, usageType);  

    // If the index is not -1, return the column.  
    // NOTE: The index that is returned is 1-based, but the input column collection is 0-based.  
    if ( index != -1 )  
        return input.InputColumnCollection[index-1];  

    // The column was removed, so return null.  
    return null;  
}  
Public Overrides Function SetUsageType(ByVal inputID As Integer, ByVal virtualInput As IDTSVirtualInput100, ByVal lineageID As Integer, ByVal usageType As DTSUsageType) As IDTSInputColumn100   
 If usageType = DTSUsageType.UT_READWRITE Then   
   Throw New Exception("Read write columns prohibited.")   
 End If   
 Dim input As IDTSInput100 = ComponentMetaData.InputCollection.GetObjectByID(inputID)   
 Dim index As Integer = virtualInput.SetUsageType(lineageID, usageType)   
 If Not (index = -1) Then   
   Return input.InputColumnCollection(index - 1)   
 End If   
 Return Nothing   
End Function  

설명

사용자 지정 구성 요소 개발자는 일반적으로 기본 클래스 SetUsageType 메서드의 재정의된 구현에서 이 메서드를 호출하여 구성 요소의 입력 열 컬렉션에서 열을 추가하거나 제거합니다. 가 UT_IGNORED이고 열이 이전에 구성 요소의 입력 열 컬렉션에 추가된 경우 eUsageType 열 인덱스가 제거됩니다. 가 UT_READONLY또는 UT_READWRITE이면 eUsageType 열이 컬렉션에 추가됩니다.

프로그래밍 방식으로 데이터 흐름 작업을 만들고 태스크의 구성 요소에 대한 열을 선택하는 개발자는 이 메서드를 호출해서는 안 됩니다. 대신 구성 SetUsageType 요소의 디자인 타임 인스턴스 메서드를 호출해야 합니다. 이 메서드를 호출하면 데이터 형식 또는 사용 유형별로 열을 제한하는 구성 요소의 기능을 직접 무시합니다.

적용 대상