ForEachEnumeratorHost.InnerObject 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回宿主的内部对象,它是正在承载的 ForEachEnumerator。
public:
property System::Object ^ InnerObject { System::Object ^ get(); };
public object InnerObject { get; }
member this.InnerObject : obj
Public ReadOnly Property InnerObject As Object
属性值
一个对象。
实现
示例
多个类由创建和创建 ForEachEnumeratorHost。 下面的代码示例演示当前可用于应用程序的枚举器、如何创建 ForEachSMOEnumerator 主机对象,然后将枚举器强制转换为 InnerObject 特定枚举器类型。
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;
}
}
}
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
End Sub
End Class
End Namespace
示例输出:
可用枚举器:Foreach 文件枚举器
可用枚举器:Foreach 项枚举器
可用枚举器:Foreach ADO 枚举器
可用枚举器:Foreach ADO.NET 架构行集枚举器
可用枚举器:Foreach From Variable Enumerator
可用枚举器:Foreach NodeList 枚举器
可用枚举器:Foreach SMO 枚举器
SMO 枚举器:Microsoft.SqlServer.Dts.Runtime.Enumerators.SMO.ForEachSMOEnumerator
Smo。EnumURN = RuntimeServer[@Variable='MachineName']/Server[@Name='localhost']/SMOEnumObj[@Name='Databases']/SMOEnumType[@Name='Names']