- The IContainer is always injected into the Container itself. This means that you can expect a constructor argument of type “IContainer” to be filled with the current Container. This does work with ObjectFactory
- “Missing Instance” handler. If you ask for an Instance by name that does not exist, Missing Instance gets a chance to handle the request
- Conditional Construction – I’ve gotten a lot of questions about “I want to do this if the user has this role, and this if he doesn’t” type of scenarios. The Conditional Instance feature bakes this into StructureMap out of the box
- Convention based Setter Injection Policies. Specify rules like “I want all public setter properties where the PropertyType is in this namespace to be injected by StructureMap”
- New functionality in IContext / BuildSession (TryGetInstance<T>() and GetInstance<T>(name))
- The BuildUp() functionality to inject dependencies through public setters of an existing object for usage in ASP.Net WebForms and other environments that do not allow you to control object creation
- Convenience methods for requesting open generic types
- Minor improvements to the Assembly Scanning. Easier ways to create auto registration policies.
- Interception techniques can now use the IContext during construction
There is one breaking change, the InstanceInterceptor interface was changed to include an IContext argument to its Process() method:
I’ll be blogging examples of the new features in the next week. Starting on Monday, there will be at least one new StructureMap tip posted every day until the end of January.
I didn’t get everything into this release that I wanted to, and I’m behind in some promises. I start the next (2.5.3) release tomorrow night. In order of priority, the upcoming release(es) will contain:
- Prism Bootstrapper (2.5.3)
- Improved Diagnostic Messages
- A Reference Common Service Locator
- Samples, Samples, Samples!
- Silverlight Version
- Medium Trust Enhancements
- Compact Framework Version
I’m hoping to get the Prism Bootstrapper out this week, and the rest by the end of January.
Where Has it Been?
Mostly out of self reflection, I thought I’d throw together a timeline for StructureMap.
- Summer ‘02 – I was a non-coding architect with no .Net or J2EE delivery experience, and I was scared. I plotted a plan to build the world’s greatest ORM in order to build up some credibility to find another job where I could code. I explained it to my then wife and she named it “StructureMap.” The name made a lot more sense back then 😉
- Christmas ‘02 – StructureMap coding begins
- Summer ‘03 – I was traveling for ThoughtWorks and away from the family a lot. At nights I was working on the configuration subsystem for my grand vision. I ran out of energy and mothballed it.
- January ‘04 – I started reading about PicoContainer in the Java world and thought to myself, “that configuration subsystem code could be morphed into this IoC/DI tool thingie.”
- Early Spring ‘04 – What became StructureMap quickly took shape at nights and on the plane trips back and forth between Chicago O’Hare and Austin.
- June 9, 2004 – Version 0.80 was released on SourceForge. StructureMap had been used in a production system shortly before the OSS release. Xml in, objects out. You could use attributes out the wazoo too.
- Jan 15, 2005 – Version 0.90 was released. Fancier ways to take Xml in, and spit out objects. I added setter injection for the first time. My first attempt at improved diagnostics.
- May 5, 2006 – Version 1.0 was released. Crazy ways to take Xml in, and spit out objects. More diagnostic tools and some NAnt tasks that have since been quietly excised
- April 2, 2007 – Version 2.0 was released. The first version of what is now the Registry DSL. I cut my teeth on Fluent Interfaces on this release. Supported open generics for the first time.
- Fall ‘07 through Fall ‘08 – StructureMap was effectively gutted and largely re-architected. It hurt, but I learned a lot and the architecture is vastly easier to extend now.
- June 23, 2008 – Version 2.4.9 was released as a compromise
- Summer ‘08 – Jimmy Bogard openly mocks me at every turn by calling the forthcoming 2.5 release the “Duke Nukem Forever” release
- Oct 27, 2008 – StructureMap 2.5 follows closely on the heals of “Chinese Democracy.” I describe 2.5 as the “Python 3000” release
- Dec 12, 2008 – Version 2.5.1 is released as a bit of a Merry Christmas present with some bug fixes that built up from the 2.5 release
- Jan 11, 2008 – Version 2.5.2 is released with some new functionality that builds on the 2.5 architecture.