次の方法で共有


IDTSVirtualInput90.SetUsageType Method

仮想入力列オブジェクトをマップし、使用法の種類を設定します。

名前空間: Microsoft.SqlServer.Dts.Pipeline.Wrapper
アセンブリ: Microsoft.SqlServer.DTSPipelineWrap (microsoft.sqlserver.dtspipelinewrap.dll 内)

構文

'宣言
<DispIdAttribute(104)> _
Function SetUsageType ( _
    <InAttribute> lLineageID As Integer, _
    <InAttribute> eUsageType As DTSUsageType _
) As Integer
[DispIdAttribute(104)] 
int SetUsageType (
    [InAttribute] int lLineageID,
    [InAttribute] DTSUsageType eUsageType
)
[DispIdAttribute(104)] 
int SetUsageType (
    [InAttribute] int lLineageID, 
    [InAttribute] DTSUsageType eUsageType
)
/** @attribute DispIdAttribute(104) */ 
int SetUsageType (
    /** @attribute InAttribute() */ int lLineageID, 
    /** @attribute InAttribute() */ DTSUsageType eUsageType
)
DispIdAttribute(104) 
function SetUsageType (
    lLineageID : int, 
    eUsageType : DTSUsageType
) : int

パラメータ

  • eUsageType
    コンポーネントによる入力列の使用方法を示す DTSUsageType 列挙の値です。

戻り値

新しく作成された IDTSInputColumn90 のインデックスです。eUsageTypeUT_IGNORED で、列が入力列コレクションから削除されている場合は -1 です。

解説

カスタム コンポーネントの開発者は、通常、基本クラス SetUsageType メソッドのオーバーライドされた実装でこのメソッドを呼び出し、コンポーネントの入力列コレクションに対して列を追加または削除します。eUsageTypeUT_IGNORED であり、列が以前にコンポーネントの入力列コレクションに追加されていた場合は、列のインデックスが削除されます。eUsageTypeUT_READONLY または UT_READWRITE である場合は、列がコレクションに追加されます。

プログラムでデータ フロー タスクを作成し、タスクでコンポーネントの列を選択している開発者は、このメソッドを呼び出さないでください。代わりに、コンポーネントのデザイン時インスタンスの SetUsageType メソッドを呼び出してください。このメソッドを直接呼び出すと、データ型または使用法の種類によって列を制限するコンポーネントの機能がバイパスされます。

使用例

次のコード例は、仮想入力の SetUsageType を使用して入力コレクションに対して列を追加および削除する SetUsageType の、コンポーネントのオーバーライドされた実装を示しています。この例で、コンポーネントでは列を書き込み可能として許可しないため、eUsageTypeUT_READWRITE である場合は、例外が発生します。

public override IDTSInputColumn90 SetUsageType(int inputID, IDTSVirtualInput90 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.
    IDTSInput90 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 IDTSVirtualInput90, ByVal lineageID As Integer, ByVal usageType As DTSUsageType) As IDTSInputColumn90 
 If usageType = DTSUsageType.UT_READWRITE Then 
   Throw New Exception("Read write columns prohibited.") 
 End If 
 Dim input As IDTSInput90 = 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 static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

対象プラットフォーム

サポートされているプラットフォームの一覧については、「SQL Server 2005 のインストールに必要なハードウェアおよびソフトウェア」を参照してください。

参照

関連項目

IDTSVirtualInput90 Interface
IDTSVirtualInput90 Members
Microsoft.SqlServer.Dts.Pipeline.Wrapper Namespace