다음을 통해 공유


ForEachSMOEnumerator.EnumURN Property

Gets or sets a String that contains the SMO enumeration Uniform Resource Name (URN) for the selected enumeration.

네임스페이스: Microsoft.SqlServer.Dts.Runtime.Enumerators.SMO
어셈블리: Microsoft.SqlServer.ForEachSMOEnumerator (in microsoft.sqlserver.foreachsmoenumerator.dll)

구문

‘선언
Public Property EnumURN As String
public string EnumURN { get; set; }
public:
virtual property String^ EnumURN {
    String^ get () sealed;
    void set (String^ value) sealed;
}
/** @property */
public final String get_EnumURN ()

/** @property */
public final void set_EnumURN (String value)
public final function get EnumURN () : String

public final function set EnumURN (value : String)

속성 값

A String that contains the enumerator's configuration parameters.

주의

The SMO enumeration URN contains four parts. First is the string, RuntimeServer. followed by a connection. The following line of code is an example of an EnumURN property where a connection has been specified.

RuntimeServer[@Connection='{B1552E8D-43AE-44B1-B5D3-03C4F5461977}']/Server[@Name='localhost']/SMOEnumObj[@Name='Databases']/SMOEnumType[@Name='Names']

The second part of the string is the server name parameter.

The last two parts of the string are the SMOEnumObj and SMOEnumType parameters. The SMOEnumObj parameter, which comes third in the four-part string, describes which enumeration object is enumerated. Valid values are:

@"LinkedServers"

@"Jobs"

@"Logins"

@"Databases"

@"FileGroups"

@"DataFiles"

@"LogFiles"

@"StoredProcedures"

@"UserDefinedDataTypes"

@"UserDefinedFunctions"

@"Views"

@"Users"

@"Tables"

@"Columns"

@"ForeignKeys"

@"Triggers

The code sample above shows an enumeration over databases.

The fourth and final part of the configuration string is the SMOEnumType parameter, which specifies the enumeration type to use. Valid values are:

@"Objects"

@"ObjectsPP"

@"Names"

@"URNs"

@"Locations"

The code sample above enumerates using names.

The ForEachSMOEnumerator object is created and hosted by a ForEachEnumeratorHost. The following code example shows how to create a ForEachSMOEnumerator within the host object.

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime.Enumerators.SMO;
using Microsoft.SqlServer.Dts.Runtime;


namespace Microsoft.SqlServer.SSIS.Samples
{
    internal class EnumType
    {
        public const string SMOEnum = "Foreach SMO Enumerator";
    }
    class Program
    {
        static void Main(string[] args)
        {
            Application app = new Application();
            ForEachEnumeratorInfos infos = app.ForEachEnumeratorInfos;
            ForEachEnumeratorInfo info = null;

            foreach (ForEachEnumeratorInfo enumInfo in infos)
            {
            Console.Write("Available enumerators: {0}\n", enumInfo.Name);
            // When the SMO enumerator is found, set the info variable.
            if (enumInfo.Name == EnumType.SMOEnum)
            {  
                info = enumInfo;
            }
        }

        ForEachEnumeratorHost enumH = info.CreateNew();
        Console.WriteLine("SMO Enumerator: " + enumH.InnerObject.ToString());
        ForEachSMOEnumerator smoEnumerator = (ForEachSMOEnumerator)enumH.InnerObject;
        smoEnumerator.EnumURN = "RuntimeServer[@Variable='MachineName']/Server[@Name='localhost']/" +
            "SMOEnumObj[@Name='Databases']/SMOEnumType[@Name='Names']";
    Console.WriteLine("SMO.EnumURN = {0}", smoEnumerator.EnumURN);
        }
    }
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime.Enumerators.SMO
Imports Microsoft.SqlServer.Dts.Runtime

Namespace Microsoft.SqlServer.SSIS.Samples
    Friend Class EnumType
        Public const String SMOEnum = "Foreach SMO Enumerator"
    End Class
    Class Program
        Shared  Sub Main(ByVal args() As String)
            Dim app As Application =  New Application() 
            Dim infos As ForEachEnumeratorInfos =  app.ForEachEnumeratorInfos 
            Dim info As ForEachEnumeratorInfo =  Nothing 

            Dim EnumInfo As ForEachEnumeratorInfo 
            Dim enumInfo As ForEachEnumeratorInfo
            End Enum
            For Each EnumInfo In infos 
            For Each EnumInfo In infos Console.Write("Available enumerators: {0}\n" EnumInfo.Name) End Enum 
            For Each enumInfo In infos
            Console.Write("Available enumerators: {0}\n" enumInfo.Name)
            End Enum
            End Enum
            ' When the SMO enumerator is found, set the info variable.
            If EnumInfo.Name = EnumType.SMOEnum Then 
            Dim EnumInfo.Name As If =  EnumType.SMOEnum Then info  =  EnumInfo  End Enum
            If enumInfo.Name = EnumType.SMOEnum Then
                info = enumInfo
            End Enum
            End Enum
            End If
            Next

        Dim EnumH As ForEachEnumeratorHost =  info.CreateNew() 
        Dim enumH As ForEachEnumeratorHost =  info.CreateNew() 
        End Enum
        Console.WriteLine("SMO Enumerator: " + EnumH.InnerObject.ToString()) 
        Console.WriteLine("SMO Enumerator: " + enumH.InnerObject.ToString())
        End Enum
        Dim smoEnumerator As ForEachSMOEnumerator = CType(EnumH.InnerObject, ForEachSMOEnumerator)
        Dim smoEnumerator As ForEachSMOEnumerator = CType(enumH.InnerObject, ForEachSMOEnumerator)
        End Enum
        smoEnumerator.EnumURN = "RuntimeServer[@Variable='MachineName']/Server[@Name='localhost']/" +
            "SMOEnumObj[@Name='Databases']/SMOEnumType[@Name='Names']"
        Console.WriteLine("SMO.EnumURN = {0}", smoEnumerator.EnumURN)
        End Sub
    End Class
End Namespace

Sample Output:

Available enumerators: Foreach File Enumerator

Available enumerators: Foreach Item Enumerator

Available enumerators: Foreach ADO Enumerator

Available enumerators: Foreach ADO.NET Schema Rowset Enumerator

Available enumerators: Foreach From Variable Enumerator

Available enumerators: Foreach NodeList Enumerator

Available enumerators: Foreach SMO Enumerator

SMO Enumerator: Microsoft.SqlServer.Dts.Runtime.Enumerators.SMO.ForEachSMOEnumerator

SMO.EnumURN = RuntimeServer[@Variable='MachineName']/Server[@Name='localhost']/SMOEnumObj[@Name='Databases']/SMOEnumType[@Name='Names']

스레드 보안

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

플랫폼

개발 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

대상 플랫폼

지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.

참고 항목

참조

ForEachSMOEnumerator Class
ForEachSMOEnumerator Members
Microsoft.SqlServer.Dts.Runtime.Enumerators.SMO Namespace