IDTSVirtualInput100.SetUsageType(Int32, DTSUsageType) 메서드

정의

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

매개 변수

lLineageID
Int32
eUsageType
DTSUsageType

반환

새로 만든 IDTSInputColumn100의 인덱스이거나 가 UT_IGNORED 열이 입력 열 컬렉션에서 제거된 경우 eUsageType -1입니다.

특성

예제

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

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  
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;  
}  

설명

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

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

적용 대상