I have been using Structuremap for years now. Which is obvious since I have 28 blogpost mentioning it. The first of those posts going back all the way to 2008 (Considering I only started blogging in 2008.
Anyway I have been using structuremap with great success since the beginning. But frameworks are like handbags. Once you have it long enough you just want a new one. Not only to brag about it with your girlfriends but sometimes just have something new and shiny that fits better with that new pair of shoes you bought. Now I won’t change IoC containers as fast as I change handbags so I have to make an informed decision.
So first of all, what is it I want from an IoC?
- Must be compatible with VB.Net (duh).
- I want a fluent interface.
- I don’t like attributes.
- Good documentation.
- Property injection
- Constructor injection
- Active community
First thing I found when looking on Google for IoC containers .Net was a post by mister Hanselman. The post is from 2008 and thus kind of old and might be obsolete. But it gave me a list of things to check out.
So here is the list of containers that made the shortlist.
- Structuremap obviously but I already know this.
- Autofac
- Ninject
And the winner is… Autofac.
Yes it has amazing documentation and I found what I wanted in there. And it does all that I had on my list and more.
So why did I discard all the others… Well you know how it is when you go in to the handbag shop and you just fall in love with the first one you see? Yeah that’s about it.
In all honesty, when picking a framework you can’t make a decision on whether you are going to like it or not just by looking at the doc. You can’t even tell whether it is any good after doing a little demo app. You can only tell if it is any good and is going to give you pain by using it on a real live program. And no matter what that is going to hurt a little. Because sometimes it’s the little things you would never have thought about that make a difference.