CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

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.



Comments

Bill Pierce said:

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.

# October 4, 2006 10:27 AM

Ayende Rahien said:

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<Blog>) or open (IRepository<>) - and if you require IRepository<Blog> it will use the config for that, but if you request anything else (IRepository<Post>) it will use the open one to create on for you.

# October 4, 2006 10:48 AM

ScottBellware said:

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<Foo>.Create()

# October 10, 2006 11:08 PM

Jeremy D. Miller -- The Shade Tree Developer said:

The real release will be over the weekend, but I&#39;m calling myself &quot;code complete&quot; for now

# March 30, 2007 9:39 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

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 previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP