StructureMap, Generics Support, and the Future

I'm working on a small bugfix release for StructureMap I promised a user this week.  You can see the open bug list on the SourceForge page (if you have a SourceForge account you can always log bugs to a project).  The big fix/enhancement that's been asked for on a couple occasions is deeper support for generic types in StructureMap.  Specifically, people are asking for the ability to do something like this:

IDao<IThing,int> dao = ObjectFactory.GetInstance<IDao<IThing,int>>();

I'm not exactly sure how it's going to work, so I'll probably post some ideas to the StructureMap mailing list on possible syntax for configuration. 

How about .Net 1.1 Support?

Where I'm definitely indecisive is continued support for the .Net 1.1 version.  I'll definitely make a new release of the 1.1 version with some of the bugfixes, but beyond that, I suspect that the .Net 2.0 version becomes the trunk for all future enhancements.  With the additional generics support, the two codebases are going to start to diverge rapidly.  Any opinions?  I'm happy to keep supporting .Net 1.1, but I'm not wild about the multiple code branches.

How's everybody else dealing with this on their open source projects?

Next Functional Release

The definite theme for the next release is ease of use.  Josh Flanagan and I have been talking about creating a new alternative configuration scheme that would be easier to use and hide some of the gritty details about the internal model that shines through in the current XML configuration.  I'm watching Ayende's work on Binsor as a possible inspiration.

Other features being kicked around:

  • Expanded attribute usage
  • A programmatic way to register types, assemblies, and instance configurations at runtime.  This is partially with an eye towards running StructureMap without any external configuration
  • Flexibility in locating the StructureMap configuration.  Either to a section in the Application config file or something altogether different.  This will probably be a plugin model.
  • ObjectFactory will be made into a templated class to make it easier to create your own custom facade classes for StructureMap

Feedback is welcome and appreciated.

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 http://codebetter.com/jeremymiller.
This entry was posted in StructureMap. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://blogs.meetandplay.com/wpierce/ Bill Pierce

    RE: 1.1 Support

    Castle Project uses directives…#IF DOTNET2…#END IF… for 2.0 specific features. They also generate a 2.0 csproj and a 1.1 csproj files that share the same code files. I think this is a good approach for a transition.

  • http://www.ayende.com/Blog/ Ayende Rahien

    About generics, take a look at how Castle Windsor is handling this.

    You can specify a generic service which is either closed -has generic parameters (IRepository) or open (IRepository<>) – and if you require IRepository it will use the config for that, but if you request anything else (IRepository ) it will use the open one to create on for you.

  • http://www.bellware.net ScottBellware

    The generic wrapper that we use for Spring uses a generic factory rather than a generic factory method. Dunno if it’ll help you at all, but maybe something along these lines would be worth consideration for StructureMap:

    Foo foo = Factory.Create()