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

LineageID 그 중 IDTSVirtualInputColumn100 일부는 지도화되고 있습니다.

eUsageType
DTSUsageType

입력 열이 컴포넌트에서 어떻게 사용되는지를 나타내는 열거 값 DTSUsageType 입니다.

반품

새로 생성된 IDTSInputColumn100인덱스 또는 -1 는 입력 열 집합에서 컬럼이 제거될 때 eUsageTypeUT_IGNORED 사용됩니다.

특성

예제

다음 코드 예시는 가상 입력 SetUsageType 을 사용해 입력 컬렉션에서 열을 추가하거나 제거하는 컴포넌트의 오버라이드 구현 SetUsageType 을 보여줍니다. 이 예시에서 컴포넌트는 열을 쓸 수 없으므로 eUsageType 예외 UT_READWRITE 가 발생한다.

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 메서드의 오버라이드 구현에서 이 메서드를 호출하여 컴포넌트의 입력 컬럼 컬렉션에서 컬럼을 추가하거나 제거합니다. 만약 eUsageType 가 이고 UT_IGNORED, 해당 열이 이미 컴포넌트의 입력 열에 추가된 상태라면, 열의 인덱스는 제거됩니다. eUsageType 가 , UT_READONLY또는 UT_READWRITE이면, 이 열이 집합에 추가됩니다.

이 메서드는 데이터 흐름 작업을 프로그래밍적으로 생성하고 작업 내 구성 요소의 열을 선택하는 개발자가 호출해서는 안 됩니다. 대신, 컴포넌트의 설계 시 인스턴스 메서드를 SetUsageType 호출해야 합니다. 이 메서드를 호출하면 컴포넌트가 데이터 타입이나 사용 유형별로 컬럼을 제한하는 기능을 직접 우회합니다.

적용 대상