Metoda IDTSVirtualInput100.SetUsageType
Mapuje obiektu wirtualnego kolumna danych wejściowych i ustawia jego typ użycia.
Przestrzeń nazw: Microsoft.SqlServer.Dts.Pipeline.Wrapper
Zestaw: Microsoft.SqlServer.DTSPipelineWrap (w Microsoft.SqlServer.DTSPipelineWrap.dll)
Składnia
'Deklaracja
Function SetUsageType ( _
lLineageID As Integer, _
eUsageType As DTSUsageType _
) As Integer
'Użycie
Dim instance As IDTSVirtualInput100
Dim lLineageID As Integer
Dim eUsageType As DTSUsageType
Dim returnValue As Integer
returnValue = instance.SetUsageType(lLineageID, _
eUsageType)
int SetUsageType(
int lLineageID,
DTSUsageType eUsageType
)
int SetUsageType(
[InAttribute] int lLineageID,
[InAttribute] DTSUsageType eUsageType
)
abstract SetUsageType :
lLineageID:int *
eUsageType:DTSUsageType -> int
function SetUsageType(
lLineageID : int,
eUsageType : DTSUsageType
) : int
Parametry
- lLineageID
Typ: System.Int32
LineageID z IDTSVirtualInputColumn100 , mapowane.
- eUsageType
Typ: Microsoft.SqlServer.Dts.Pipeline.Wrapper.DTSUsageType
Wartość z DTSUsageType wyliczenia wskazująca sposobu wprowadzania kolumna jest używana przez składnik.
Wartość zwracana
Typ: System.Int32
Nowo utworzony indeks IDTSInputColumn100, lub -1, jeśli eUsageType jest UT_IGNORED i kolumna zostanie usunięty z kolekcja wprowadzania kolumna.
Uwagi
Deweloperzy niestandardowy składnik wywołać tej metoda zwykle w realizacji zastąpiona klasą bazową SetUsageType metoda, aby dodać lub usunąć kolumna z kolumna wprowadzania kolekcja składnika.Jeśli eUsageType jest UT_IGNORED, a kolumna uprzednio zostały dodane do kolekcja kolumna wejściowe składnika, usunąć indeks kolumna.Jeśli eUsageType jest UT_READONLY, lub UT_READWRITE, kolumna jest dodawane do kolekcja.
Nie można wywołać tej metoda przez deweloperów tworzących programowo zadanie przepływ danych i wybierając kolumny dla składników w zadaniu.Zamiast tego SetUsageType metoda projektowania -czas instancji składnika należy wywołać.Wywołanie tej metoda bezpośrednio Pomija możliwość ograniczania kolumny Typ danych lub typ użycia składnika.
Przykłady
Poniższy przykład kodu pokazuje wykonania przesłonięte składnika SetUsageType używający wprowadzania wirtualnego SetUsageType do dodawania i usuwania kolumn z kolekcja danych wejściowych.W tym przykładzie składnik nie zezwala na zapisywalny kolumn tak, gdy eUsageType jest UT_READWRITE wystąpi wyjątek.
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
Zobacz także