ForEachEnumeratorHost.SetExpression(String, String) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정한 식을 속성에 할당합니다. 속성에서 기존 식을 제거하려면 null을 지정합니다.
public:
virtual void SetExpression(System::String ^ propertyName, System::String ^ expression);
public void SetExpression (string propertyName, string expression);
abstract member SetExpression : string * string -> unit
override this.SetExpression : string * string -> unit
Public Sub SetExpression (propertyName As String, expression As String)
매개 변수
- propertyName
- String
식을 할당할 속성의 이름입니다.
- expression
- String
식입니다.
구현
예제
다음 코드 예제에서는 에서 SMO 열거자를 ForEachEnumeratorHost호스트합니다. 메서드 DelayValidation
를 SetExpression 사용하여 속성을 수정한 다음 메서드를 사용하여 GetExpression 식을 검색합니다.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
namespace Microsoft.SqlServer.SSIS.Sample
{
internal class EnumType
{
public const string SMOEnum = "Foreach SMO Enumerator";
}
class SSISProgram
{
static void Main(string[] args)
{
Application app = new Application();
Package pkg = new Package();
ForEachEnumeratorInfos infos = app.ForEachEnumeratorInfos;
ForEachEnumeratorInfo info = null;
foreach (ForEachEnumeratorInfo enumInfo in infos)
{
// Uncomment the next line of you want to see all enumerators.
//Console.Write("Available enumerators: {0}\n", enumInfo.Name);
if (enumInfo.Name == EnumType.SMOEnum)
{
// Set the ForEachEnumeratorInfo variable
// to the SMO enumerator, and use it
// later in the CreateNew method.
info = enumInfo;
}
}
ForEachEnumeratorHost enumH = info.CreateNew();
Console.WriteLine();
// Show the description before it is modified.
Console.WriteLine("DelayValidation: {0}", enumH.DelayValidation);
// Modify the Description using SetExpression.
//String myExpression = "\"My Description for SMO enumerator\"";
String myExpression = "true";
enumH.SetExpression("DelayValidation", myExpression);
DTSExecResult result = pkg.Validate(null, null, null, null);
// Review the new value and expression.
String newExpr = enumH.GetExpression("DelayValidation");
Console.WriteLine("New DelayValidation: {0}", enumH.DelayValidation);
Console.WriteLine("Expression: {0}", newExpr);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Friend Class EnumType
Public Const SMOEnum As String = "Foreach SMO Enumerator"
End Class 'EnumType
Class SSISProgram
Shared Sub Main(ByVal args() As String)
Dim app As New Application()
Dim pkg As New Package()
Dim infos As ForEachEnumeratorInfos = app.ForEachEnumeratorInfos
Dim info As ForEachEnumeratorInfo = Nothing
Dim enumInfo As ForEachEnumeratorInfo
For Each enumInfo In infos
' Uncomment the next line of you want to see all enumerators.
'Console.Write("Available enumerators: {0}\n", enumInfo.Name);
If enumInfo.Name = EnumType.SMOEnum Then
' Set the ForEachEnumeratorInfo variable
' to the SMO enumerator, and use it
' later in the CreateNew method.
info = enumInfo
End If
Next enumInfo
Dim enumH As ForEachEnumeratorHost = info.CreateNew()
Console.WriteLine()
' Show the description before it is modified.
Console.WriteLine("DelayValidation: {0}", enumH.DelayValidation)
' Modify the Description using SetExpression.
'String myExpression = "\"My Description for SMO enumerator\"";
Dim myExpression As String = "true"
enumH.SetExpression("DelayValidation", myExpression)
Dim result As DTSExecResult = pkg.Validate(Nothing, Nothing, Nothing, Nothing)
' Review the new value and expression.
Dim newExpr As String = enumH.GetExpression("DelayValidation")
Console.WriteLine("New DelayValidation: {0}", enumH.DelayValidation)
Console.WriteLine("Expression: {0}", newExpr)
End Sub 'Main
End Class 'SSISProgram
샘플 출력:
DelayValidation: False
새 DelayValidation: False
식: true