Survey: Changing config api? Ok, or not? Need reply ASAP

Dec 1, 2009 at 7:48 PM

I'm elbow deep in redoing the Unity config schema right now, and part of the implementation is getting me wrapped around a pole. For those who've looked at the implementation, there's an object in there called a TypeResolver. This object is responsible for looking at type aliases and substituting the real types for the alias. This object needs to be passed down through the config element hierarchy, and it's a real pain, with code in essentially every config property getter to set it all the way down the graph.

I have an alternative approach which is a lot cleaner, but the current configuration api:

section.Containers[containerName].Configure(unityContainer);

gets in the way. Would you be extremely annoyed if I broke the API in 2.0, and instead made you do this:

section.ConfigureContainer(unityContainer, containerName)

or

section.ConfigureContainer(unityContainer) // when using default container in configuration

?

I am also thinking of adding an extension method on IUnityContainer to do configuration regardless:

unityContainer.LoadConfiguration(section, containerName);

Anyway, how painful would this public API breakage be for you? Out of the question, annoying, no problem? Thanks,

 

-Chris

 

Dec 1, 2009 at 10:20 PM
Edited Dec 1, 2009 at 10:22 PM
So if the following is correct, no problems with me !!!  I think the change is relatively minor
// Original
foreach ( UnityContainerElement containerElement in section.Containers )
{
	IUnityContainer current = new UnityContainer().AddExtension( new TrackingContainerExtension() );
	containerElement.Configure( current );
}


// New
foreach ( UnityContainerElement containerElement in section.Containers )
{
	IUnityContainer current = new UnityContainer().AddExtension( new TrackingContainerExtension() );
	section.ConfigureContainer( current, containerElement.Name );
}
ps. The TrackingContainerExtension is a UnityContainerExtension that ultimately allows me to query the container for registration maps
Dec 1, 2009 at 11:13 PM

Yep, that's exactly the idea.

(Also, in our next drop we'll have the introspection story done, so you won't need the TrackingContainerExtension anymore).