IDTSVirtualInput100 接口

定义

public interface class IDTSVirtualInput100 : Microsoft::SqlServer::Dts::Pipeline::Wrapper::Sql2014::IDTSObject100
[System.Runtime.InteropServices.Guid("DD9E7F1F-A112-4EBD-9178-EE7DB0F2EDEC")]
[System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FDispatchable | System.Runtime.InteropServices.TypeLibTypeFlags.FDual)]
public interface IDTSVirtualInput100 : Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2014.IDTSObject100
[<System.Runtime.InteropServices.Guid("DD9E7F1F-A112-4EBD-9178-EE7DB0F2EDEC")>]
[<System.Runtime.InteropServices.TypeLibType(System.Runtime.InteropServices.TypeLibTypeFlags.FDispatchable | System.Runtime.InteropServices.TypeLibTypeFlags.FDual)>]
type IDTSVirtualInput100 = interface
    interface IDTSObject100
Public Interface IDTSVirtualInput100
Implements IDTSObject100
属性
实现

示例

下面的代码示例演示如何在以编程方式生成数据流任务时使用虚拟输入选择组件使用的列。

Public Sub SelectColumns(ByVal md As IDTSComponentMetaData100)   
 Dim wrp As CManagedComponentWrapper = md.Instantiate   
 For Each input As IDTSInput100 In md.InputCollection   
   Dim vInput As IDTSVirtualInput100 = input.GetVirtualInput   
   For Each vCol As IDTSVirtualInputColumn100 In vInput.VirtualInputColumnCollection   
     wrp.SetUsageType(input.ID, vInput, vCol.LineageID, DTSUsageType.UT_READONLY)   
   Next   
 Next   
End Sub  
public void SelectColumns(IDTSComponentMetaData100 md)  
{  
    // Create the design time instance of the component.  
    CManagedComponentWrapper wrp = md.Instantiate();  

    // Walk the input collection.  
    foreach (IDTSInput100 input in md.InputCollection)  
    {  
        // Get the virtual input columns.  
        IDTSVirtualInput100 vInput = input.GetVirtualInput();  

        // For each virtual column, set its usagetype to READONLY.  
        foreach (IDTSVirtualInputColumn100 vCol in vInput.VirtualInputColumnCollection)  
            wrp.SetUsageType(input.ID, vInput, vCol.LineageID, DTSUsageType.UT_READONLY);  
    }  
}  

下面的代码示例演示了一个自定义数据流组件,该组件在输入连接到路径时从虚拟输入中选择所有DT_STR列。

public override void OnInputPathAttached(int inputID)  
{  
    IDTSInput100 input = ComponentMetaData.InputCollection.GetObjectByID(inputID);  
    IDTSVirtualInput100 vInput = input.GetVirtualInput();  

    foreach (IDTSVirtualInputColumn100 vCol in vInput.VirtualInputColumnCollection)  
    {  
        if (vCol.DataType == DataType.DT_STR)  
        {  
            this.SetUsageType(inputID, vInput, vCol.LineageID, DTSUsageType.UT_READONLY);  
        }  
    }  
}  
Public Overrides Sub OnInputPathAttached(ByVal inputID As Integer)   
 Dim input As IDTSInput100 = ComponentMetaData.InputCollection.GetObjectByID(inputID)   
 Dim vInput As IDTSVirtualInput100 = input.GetVirtualInput   
 For Each vCol As IDTSVirtualInputColumn100 In vInput.VirtualInputColumnCollection   
   If vCol.DataType = DataType.DT_STR Then   
     Me.SetUsageType(inputID, vInput, vCol.LineageID, DTSUsageType.UT_READONLY)   
   End If   
 Next   
End Sub  

注解

通过调用 GetVirtualInput 对象的方法 IDTSInput100 检索 IDTSVirtualInput100。 该 VirtualInputColumnCollection 属性包含图形中上游组件提供的列。

以编程方式生成数据流任务时,通过调用 SetUsageType 组件的方法 CManagedComponentWrapperClass为组件选择虚拟列。

编写自定义数据流组件的开发人员使用虚拟输入来发现可用的上游列,并根据组件将列添加到基于虚拟集合中的列的输入。

由于虚拟输入是上游列的反射,因此对虚拟输入集合中的列的修改不会对 IDTSOutput100 自身产生任何影响。

属性

Description
ID
IdentificationString
IsSorted
Name
ObjectType
SourceLocale
VirtualInputColumnCollection

方法

SetUsageType(Int32, DTSUsageType)

适用于