次の方法で共有


IDTSRuntimeConnection90.ConnectionManager Property

ランタイム接続オブジェクトによって参照されている IDTSConnectionManager90 オブジェクトを取得します。値の設定も可能です。

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

構文

'宣言
<DispIdAttribute(102)> _
Property ConnectionManager As IDTSConnectionManager90
[DispIdAttribute(102)] 
IDTSConnectionManager90 ConnectionManager { get; set; }
[DispIdAttribute(102)] 
property IDTSConnectionManager90^ ConnectionManager {
    IDTSConnectionManager90^ get ();
    void set ([InAttribute] IDTSConnectionManager90^ ppIDTSConnectionManager);
}
/** @property */
/** @attribute DispIdAttribute(102) */ 
IDTSConnectionManager90 get_ConnectionManager ()

/** @property */
/** @attribute DispIdAttribute(102) */ 
void set_ConnectionManager (/** @attribute InAttribute() */ IDTSConnectionManager90 ppIDTSConnectionManager)
DispIdAttribute(102) 
function get ConnectionManager () : IDTSConnectionManager90

DispIdAttribute(102) 
function set ConnectionManager (ppIDTSConnectionManager : IDTSConnectionManager90)

プロパティ値

コンポーネントの IDTSConnectionManager90 です。

解説

ConnectionManager プロパティは、パッケージに含まれている IDTSConnectionManager90 オブジェクトの実際のインスタンスへの参照を格納、または設定します。実行時に、この参照は SSIS ランタイム エンジンによって ConnectionManagerID プロパティを使用して自動的に設定されます。これにより、パッケージ内で接続を検索したり、参照を割り当てることが可能になります。

デザイン時に、SSIS デザイナは、コンポーネントを読み込んで初期化する際、この割り当てを実行します。ただし、デザイナの外部にあるオブジェクト モデルを使用し、プログラムでコンポーネントを読み込んで編集する場合は、プロパティを明示的に設定する必要があります。パッケージの Connections コレクションがコンポーネントに公開されないので、コンポーネントは ConnectionManagerID プロパティを使用して明示的に接続を参照することはできません。

使用例

次のコード例は、パッケージをプログラムによって読み込む場合の ConnectionManager プロパティを設定しています。

// TODO: Replace the path to the package with a valid path.
string package = @"c:\Package.dtsx";

// Create the application and load the package.
Application a = new Application();
Package p = a.LoadPackage( package , null );

// Walk the Executables collection looking for data flow tasks.
foreach (Executable e in p.Executables)
{
    MainPipe mp = ((TaskHost)e).InnerObject as MainPipe;
    if( e != null )
    {
        // Walk the components.
        foreach( IDTSComponentMetaData90 md in mp.ComponentMetaDataCollection )
        {
            // Walk the RuntimeConnectionCollection.
            foreach( IDTSRuntimeConnection90 rc in md.RuntimeConnectionCollection )
            {
                // Check to see if the package's connections collection contains the 
                // Connectionmanager stored in the RuntimeConnection.
                if (p.Connections.Contains(rc.ConnectionManagerID))
                    rc.ConnectionManager = DtsConvert.ToConnectionManager90(p.Connections[rc.ConnectionManagerID]);
                else
                    Console.WriteLine("The ConnectionManager " + rc.ConnectionManagerID + " was not found in the Package's Connections collection.");
            }
        }
    }
}
' TODO: Replace the path to the package with a valid path.
Dim package As String = "c:\Package.dtsx" 

' Create the application and load the package.
Dim a As Application = New Application 
Dim p As Package = a.LoadPackage(package, Nothing) 

' Walk the Executables collection looking for data flow tasks.
For Each e As Executable In p.Executables 
 Dim mp As MainPipe = CType(CType(e, TaskHost).InnerObject, MainPipe) 
 If Not (e Is Nothing) Then 
   ' Walk the components.
   For Each md As IDTSComponentMetaData90 In mp.ComponentMetaDataCollection 
     ' Walk the RuntimeConnectionCollection.
     For Each rc As IDTSRuntimeConnection90 In md.RuntimeConnectionCollection 
       ' Check to see whether the package's connections collection  
       '  contains the Connectionmanager stored in the RuntimeConnection.
       If p.Connections.Contains(rc.ConnectionManagerID) Then 
         rc.ConnectionManager = DtsConvert.ToConnectionManager90(p.Connections(rc.ConnectionManagerID)) 
       Else 
         Console.WriteLine("The ConnectionManager " + rc.ConnectionManagerID + " was not found in the Package's Connections collection.") 
       End If 
     Next 
   Next 
 End If 
Next

スレッド セーフ

この型の public static (Microsoft Visual Basic では共有 ) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

プラットフォーム

開発プラットフォーム

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

対象プラットフォーム

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

参照

関連項目

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