The permanent issue/feature in GitHub is at
https://github.com/structuremap/structuremap/issues/52.
There's a fair amount of cruft in StructureMap's Xml configuration support that I think should be cleaned out for the 3.0 release. As several people have suggested, I think I would like to at least consider moving the Xml configuration into a separate library/nuget as an add-on. That being said, here's what I'm thinking to keep and change:
Keep:
<StructureMap> <!-- Eliminating the old @MementoStyle attribute. Only the terser "attribute normalized" style will be supported from here on out
<!-- Was "<AddInstance>", equivalent to Registry.For(plugin type).Add(type) -->
<Add PluginType="assembly qualified name" Type="assembly qualified name" CtorArg1="" CtorArg2="" />
<!-- Was "<DefaultInstance>", equivalent to Registry.For(plugin type).Use(type)
<Use PluginType="assembly qualified name" Type="assembly qualified name" CtorArg1="" CtorArg2="" />
<Profile Name="profile">
<Add ..... />
<Use ..... />
</Profile>
<!-- loads a Registry by type -->
<Registry Type="assembly qualified name" />
</StructureMap>
What goes
Everything else should go. The <PluginFamily>/<Plugin>/<Instance> structure especially needs to go because it bleeds StructureMap internals right into a user's face. The <Machine> node goes. <Assembly> node goes.
Loading Xml
From the expression to initialize a Container, I vote for leaving this unchanged:
var container = new Container(x => {
x.IncludeConfigurationFromConfigFile = true/false; // unchanged from 2.6
x.AddConfigurationFromXmlFile(string file)
x.AddConfigurationFromNode(XmlNode); //gives you the ability to add Xml in any possible way you'd like
});
However, I'm voting that we kill off the old "StructureMap.config" file options in:
ObjectFactory.Initialize(x => {
x.UseDefaultStructureMapConfigFile = true/false;
x.IgnoreStructureMapConfig();
x.PullConfigurationFromAppConfig();
});
Moving forward I'm thinking that the initialization for ObjectFactory and Container is the same thing, and ObjectFactory.Initialize(nested closure) is essentially:
ObjectFactory.Container = new Container(nested closure)
Thoughts?