Export (0) Print
Expand All

ForEachEnumeratorHost.InnerObject Property

Returns the inner object of the host, which is the ForEachEnumerator that is being hosted.

Namespace:  Microsoft.SqlServer.Dts.Runtime
Assembly:  Microsoft.SqlServer.ManagedDTS (in Microsoft.SqlServer.ManagedDTS.dll)

public Object InnerObject { get; }

Property Value

Type: Object
An object.

Implements

IDTSObjectHost.InnerObject

Several classes are created and by the ForEachEnumeratorHost. The following code example shows the enumerators currently available to the application, how to create the ForEachSMOEnumerator within the host object, and then cast the InnerObject to the specific enumerator type.

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;
        }
    }
}

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']

Community Additions

ADD
Show:
© 2015 Microsoft