StructureMap 2.5.3 is Released – and the future of StructureMap


I just uploaded the binary release for StructureMap 2.5.3 (download it here).  It’s mostly just a small bug fix release, but there are some new little features that might be helpful.  The new stuff is:



  • GetInstance<T>(name) with explicit args
  • Cleanup convenience methods on HttpContext and ThreadLocal.  HttpContextBuildPolicy.DisposeAndClearAll(), ThreadLocalStoragePolicy.DisposeAndClearAll().  Calling either method will eject all cached instances and call IDispose if the object is IDisposable.
  • Added a partial trust attribute to StructureMap: [assembly: AllowPartiallyTrustedCallers]
  • Daniel Guenter contributed a patch that forces StructureMap to create a new object instance every time to disable the BuildSession caching on a PluginType basis.  The syntax is:  ForRequestedType<IType>().AlwaysUnique().*************
  • James Willock contributed a patch on the HttpSession lifecycle.  I took another step to make HttpSession default to ThreadLocal if the HttpContext.Current does not exist.
  • You can now add a Registry via Xml configuration
  • Slight improvements to diagnostic messages
  • Made some attribute changes for Azure support


The Future:

My very next priority with StructureMap is frankly to get out of StructureMap development for awhile.  To that end, I’m hoping to turn StructureMap into more of a community project instead of Jeremy’s project.  In the last couple weeks I’ve gotten 3-4 volunteers to be committers to StructureMap, and frankly, I think it’s going to be much better for that.  This release was largely the result of patches sent to me from users, and I definitely appreciate that.  I need to get some sort of process / tracking in place for patches.  The next priorities are:

  • NHibernate Bootstrapper/Registry – basically, I want something that you either pick up out of the box or customize to get NHibernate bootstrapped very quickly with StructureMap.  It will most certainly support Fluent NHibernate and Linq for NHibernate
  • WCF Integration with StructureMap
  • A Silverlight version.  Scott MacLellan has already sent me a patch for this, but I just didn’t have time to apply it today.
  • Maybe, an idiomatic StructureMap Prism bootstrapper.  I started it, but had to put it on the backburner.  In the meantime, Ward Bell has a generic Prism bootstrapper that makes the IoC container pluggable, or David Mohundro wrote a StructureMap Prism bootstrapper based on the Unity Bootstrapper.  I don’t have the links handy, but I’ll find them if anyone asks.


For my part, I’m hoping to get some documentation together on StructureMap’s internal design and extension points as a guide for other developers to work with the StructureMap codebase.

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at
This entry was posted in StructureMap. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • mark Kharitonov

    Add my vote for the Silverlight version.

  • Best Registry Cleaner

    Thanks for all the time you put into this.

  • Russell


    I’d like to add my vote for a Silverlight version of StructureMap. I’d really like to pull Unity out of my project.

  • Adam Greene

    I have written a BytecodeProvider for NHibernate 2.1 for StructureMap (and a google search did not turn up any other implementation, so …) How do I contribute that?

    I also have a NHibernate Registry and IRepository pattern that I created, but it needs more work before I contribute it (if at all needed).

  • Mamboer

    Hello, i’m waiting for the silverlight version~
    When will it be coming out?

  • Anders Persson

    Found ThreadLocalStoragePolicy.DisposeAndClearAll() quite useful today.. thanks!

  • Reddy

    Looking forward for NHibernate Bootstrapper/Registry.

  • Jon Kruger

    Thanks for all the time you put into this. StructureMap is awesome and I use it on pretty much every project now. It’s very easy to use and easy to learn.

  • Jonty

    Hi Jeremy,

    I’m getting a warning when I inherit from the registry class:

    base type ‘StructureMap.Configuration.DSL.Registry’ is not CLS-compliant

    Any idea why this is?

  • Claudio Lassala

    Hi Jeremy,

    I’d like to get whatever links or information on using SM in Prism apps. I’ve been using Unity in a project, but would like to try out SM in other ones.

  • Brian

    Very excited about:

    In the site for SM, you have this very important tid-bit:

    Do not use StructureMap if an application or process requires little flexibility. The abstraction and indirection afforded by StructureMap is unnecessary and even harmful in simpler systems or processes.

    I frequently get into discussions with people who thrive on ‘what other people did for success’ (in a completely different situation of course) and thus do exactly what you say not to do. It would be great to have a ‘full post’ on this from you to point people to, particularly on IoC.

    Where I particularly run into issues is I have a few applications now that are TDD (but not IoC) and ‘certain people’ would like to see us use IoC, but there is no call for it and would just add unneeded complexity and maintenance costs.

    As a community I think we focus 90% on good ideas and only 10% on when to use those good ideas and where. I’m guilty of it too, particularly in testing.