TaskHost.InnerObject 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
이 메서드는 TaskHost.
public:
property System::Object ^ InnerObject { System::Object ^ get(); };
[System.ComponentModel.Browsable(false)]
public object InnerObject { get; }
[<System.ComponentModel.Browsable(false)>]
member this.InnerObject : obj
Public ReadOnly Property InnerObject As Object
속성 값
에 포함된 TaskHost객체.
구현
- 특성
예제
다음 코드 예시는 패키지에 a FileSystemTask 와 BulkInsertTask 를 추가하고, 작업의 메서드 TaskHost 를 사용하여 InnerObject 작업 유형을 결정하는 루프 내에서 작업을 검색합니다.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;
using Microsoft.SqlServer.Dts.Tasks.FileSystemTask;
namespace Microsoft.SqlServer.SSIS.Samples
{
class Program
{
static void Main(string[] args)
{
Package p = new Package();
// Add a File System task to the package.
Executable exec1 = p.Executables.Add("STOCK:FileSystemTask");
TaskHost thFileSystemTask1 = exec1 as TaskHost;
// Add a Bulk Insert task to the package.
Executable exec2 = p.Executables.Add("STOCK:BulkInsertTask");
TaskHost thFileSystemTask2 = exec2 as TaskHost;
// Iterate through the package Executables collection.
Executables pExecs = p.Executables;
foreach (Executable pExec in pExecs)
{
TaskHost taskHost = (TaskHost)pExec;
Console.WriteLine("Type {0}", taskHost.InnerObject.ToString());
if (taskHost.InnerObject is Microsoft.SqlServer.Dts.Tasks.FileSystemTask.FileSystemTask)
{
// Do work here.
}
else if (taskHost.InnerObject is Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask)
{
// Do work here.
}
// Continue to add statements to check InnerObject, if desired.
}
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask
Namespace Microsoft.SqlServer.SSIS.Samples
Class Program
Shared Sub Main(ByVal args() As String)
Dim p As Package = New Package()
' Add a File System task to the package.
Dim exec1 As Executable = p.Executables.Add("STOCK:FileSystemTask")
Dim thFileSystemTask1 As TaskHost = exec1 as TaskHost
' Add a Bulk Insert task to the package.
Dim exec2 As Executable = p.Executables.Add("STOCK:BulkInsertTask")
Dim thFileSystemTask2 As TaskHost = exec2 as TaskHost
' Iterate through the package Executables collection.
Dim pExecs As Executables = p.Executables
Dim pExec As Executable
For Each pExec In pExecs
Dim taskHost As TaskHost = CType(pExec, TaskHost)
Console.WriteLine("Type {0}", taskHost.InnerObject.ToString())
If TypeOf taskHost.InnerObject Is Microsoft.SqlServer.Dts.Tasks.FileSystemTask.FileSystemTask Then
' Do work here.
Else If TypeOf taskHost.InnerObject Is Microsoft.SqlServer.Dts.Tasks.BulkInsertTask.BulkInsertTask Then
' Do work here.
End If
' Continue to add statements to check InnerObject, if desired.
Next
End Sub
End Class
End Namespace
샘플 출력:
Microsoft를 입력하세요. SqlServer.Dts.Tasks.FileSystemTask.FileSystemTask
Microsoft를 입력하세요. SqlServer.dts.Tasks.BulkInsertTask.BulkInsertTask
설명
특정 작업 인스턴스를 작업 유형으로 캐스팅 InnerObjectTaskHost 하여 가져올 수 있습니다. 그 다음 작업의 객체를 사용해 메서드와 속성에 직접 접근합니다.