Configurations.InsertAfter(Object, Configuration) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
기존 Configuration 객체 다음에 컬렉션에 객체를 추가합니다Configuration.
public:
void InsertAfter(System::Object ^ index, Microsoft::SqlServer::Dts::Runtime::Configuration ^ config);
public void InsertAfter(object index, Microsoft.SqlServer.Dts.Runtime.Configuration config);
member this.InsertAfter : obj * Microsoft.SqlServer.Dts.Runtime.Configuration -> unit
Public Sub InsertAfter (index As Object, config As Configuration)
매개 변수
- index
- Object
이미 컬렉션에 포함된 객체의 Configuration 이름, 설명, ID 또는 정체성입니다.
- config
- Configuration
Configuration 컬렉션에 삽입할 개체입니다.
예제
다음 코드 예시는 세 가지 구성을 생성하여 하나의 패키지에 추가합니다. 그 후 이름이 표시되고, 이름은 추가된 순서대로 표시됩니다. 를 사용하여 InsertAfter인덱스 위치 1에 위치한 구성 다음에 위치 0에 첫 번째 구성을 삽입합니다. 이름들은 다시 표시되며, Conf1 컬렉션 뒤 Conf2 에 복사된 모습으로 표시됩니다.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace Configurations_API
{
class Program
{
static void Main(string[] args)
{
Package p = new Package();
Configuration conf1 = p.Configurations.Add();
conf1.ConfigurationString = "Conf1 Configuration String";
conf1.ConfigurationType = DTSConfigurationType.EnvVariable;
conf1.Description = "Some description for Conf1 configuration";
conf1.Name = "Conf1";
conf1.PackagePath = "A Variable Name in configuration Conf1";
Configuration conf2 = p.Configurations.Add();
conf2.ConfigurationString = "Conf2 Configuration String";
conf2.ConfigurationType = DTSConfigurationType.ConfigFile;
conf2.Description = "Some description for Conf2 configuration";
conf2.Name = "Conf2";
conf2.PackagePath = "A Variable Name in configuration Conf2";
Configuration conf3 = p.Configurations.Add();
conf3.ConfigurationString = "Conf3 Configuration String2";
conf3.ConfigurationType = DTSConfigurationType.RegEntry;
conf3.Description = "Conf3 description for Conf3 configuration2";
conf3.Name = "Conf3";
conf3.PackagePath = "A Variable Name in configuration Conf3";
DTSExecResult pkgExecResults = p.Execute();
if (pkgExecResults == DTSExecResult.Success)
{
Console.WriteLine("Success!");
// Iterate over the configurations.
Configurations configs = p.Configurations;
foreach (Configuration config in configs)
{
// This is an ordered collection, they display in the order added.
Console.WriteLine("Configuration Name {0}", config.Name);
}
Console.WriteLine("---------------------------------------------------");
// Using the Configurations methods, move the configurations around.
Configuration movingConfig = p.Configurations[0];
p.Configurations.InsertAfter(1, movingConfig);
foreach (Configuration config in configs)
{
Console.WriteLine("Configuration Name {0}", config.Name);
}
Console.WriteLine("---------------------------------------------------");
}
else
{
Console.WriteLine("Results were {0}", pkgExecResults);
}
Console.WriteLine("number of configuration in package {0}", p.Configurations.Count);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace Configurations_API
Class Program
Shared Sub Main(ByVal args() As String)
Dim p As Package = New Package()
Dim conf1 As Configuration = p.Configurations.Add()
conf1.ConfigurationString = "Conf1 Configuration String"
conf1.ConfigurationType = DTSConfigurationType.EnvVariable
conf1.Description = "Some description for Conf1 configuration"
conf1.Name = "Conf1"
conf1.PackagePath = "A Variable Name in configuration Conf1"
Dim conf2 As Configuration = p.Configurations.Add()
conf2.ConfigurationString = "Conf2 Configuration String"
conf2.ConfigurationType = DTSConfigurationType.ConfigFile
conf2.Description = "Some description for Conf2 configuration"
conf2.Name = "Conf2"
conf2.PackagePath = "A Variable Name in configuration Conf2"
Dim conf3 As Configuration = p.Configurations.Add()
conf3.ConfigurationString = "Conf3 Configuration String2"
conf3.ConfigurationType = DTSConfigurationType.RegEnTry
conf3.Description = "Conf3 description for Conf3 configuration2"
conf3.Name = "Conf3"
conf3.PackagePath = "A Variable Name in configuration Conf3"
Dim pkgExecResults As DTSExecResult = p.Execute()
If pkgExecResults = DTSExecResult.Success Then
Console.WriteLine("Success!")
' Iterate over the configurations.
Dim configs As Configurations = p.Configurations
Dim config As Configuration
For Each config In configs
' This is an ordered collection, they display in the order added.
Console.WriteLine("Configuration Name {0}", config.Name)
Next
Console.WriteLine("---------------------------------------------------")
' Using the Configurations methods, move the configurations around.
Dim movingConfig As Configuration = p.Configurations(0)
p.Configurations.InsertAfter(1, movingConfig)
Dim config As Configuration
For Each config In configs
Console.WriteLine("Configuration Name {0}", config.Name)
Next
Console.WriteLine("---------------------------------------------------")
Else
Console.WriteLine("Results were {0}", pkgExecResults)
End If
Console.WriteLine("number of configuration in package {0}", p.Configurations.Count)
End Sub
End Class
End Namespace
샘플 출력:
성공!
구성 이름 Conf1
구성 이름 conf2
구성 이름 conf3
---------------------------------------------------
구성 이름 Conf1
구성 이름 conf2
구성 이름 Conf1
구성 이름 conf3
---------------------------------------------------
패키지 4의 구성 수
설명
객체를 Configuration 컬렉션에 삽입합니다. 새로운 위치는 매개변수로 index 지정된 객체 다음에 위치합니다.