IDTSVirtualInput100.SetUsageType(Int32, DTSUsageType) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
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
戻り値
がUT_IGNOREDされ、列が入力列コレクションから削除された場合eUsageType
は、新しく作成IDTSInputColumn100された のインデックス。-1。
- 属性
例
次のコード例は、仮想入力の SetUsageType を使用して入力コレクションの列を追加および削除するコンポーネントのオーバーライドされた 実装 SetUsageType を示しています。 この例では、コンポーネントでは列を書き込み可能にできないため、 が UT_READWRITEの場合 eUsageType
は例外が発生します。
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 コンポーネントのデザイン時インスタンスの メソッドを呼び出す必要があります。 このメソッドを直接呼び出すと、データ型または使用法の種類によって列を制限するコンポーネントの機能がバイパスされます。