I was in Unity 1.2, use the following code:
UnityConfigurationSection UnitySection = (UnityConfigurationSection)ConfigurationManager.GetSection("Unity");
Dicti开发者_JAVA百科onary<string, IUnityContainer> Containers = new Dictionary<string, IUnityContainer>();
foreach (UnityContainerElement element in UnitySection.Containers)
{
IUnityContainer container = new UnityContainer();
Containers.Add(element.Name, container);
element.Configure(Containers[element.Name]);
}
but, I couldn't do so in the Unity 2.0 beta2, because The class 'UnityContainerElement' does not exist in Unity 2 beta2.
How can I do this in the new version?
It have been renamed to ContainerElement.
精彩评论