Microsoft’s IoC Container is no longer BETA – Please Welcome the Unity 1.0!

One Line Statement

Microsoft’s IoC container Unity, hosted on CodePlex as an Application Block for Enterprise Library is now released in ver. 1.0.


If you do not know what IoC is, you might want to check sample articles:

I have been interested in Dependency Injection (DI) and Inversion of Control (IoC) for few months, and I brought other guys interested too such as Mohamed Nour :D. I’m not going to discuss when I believe those strategies should be used, and how they relate to each others (at least not in this post).

The usual story

If you know about IoC, you’d know that there’re few big players in the field that are speaking .NET. I’ll not compare them here. I’m not even talking about them with relevance to time order, but I like to see how the "vendors / characteristics" map looks like.  For comparisons, check the end of this section.

The usual story, a player coming from Java world, moving from Java’s Spring to .NET’s Spring.NET. As you’d expect, this is the one mostly in love with XML configurations – too much of them sometimes, but, it’s the most mature one.

Then, as for everything coming from other worlds, Castle group/project was interested. They had their own player, Windsor. Windsor is of course less XML-ish, and as you may expect, it fits best in combination with other Castle stuff. As usual with Castle, the documentation is way far from complete, however, a funny joke about it is someone saying that a big feature of Windsor is that Ayende blogs a lot about it!

Also as usual, there had to be an individual player who tries to do the thing from scratch. That was StructureMap.

For a true comparison between those players, check the following articles:

Here comes Microsoft

As happened with AJAX and unit testing frameworks, when Microsoft decided to create it’s own game into the scenes, Microsoft has come to this ground as well to make its standard flavor, going with the relatively recent strategy of not trying to kill the existing players (The proof is approving supporting them in ASP.NET MVC Framework).

Microsoft IoC container as usual had a unique characteristic, and as usual, the unique thing is related to integration with more MS stuff. The Unity IoC container is actually an Enterprise Library Application Block. It’s meant to be part of Enterprise Library 4.0. Although Enterprise Library 4.0 is not "released" yet, The Unity Application Block itself is done 1.0, and available to download and use.

Being part of the Enterprise Library (and being an IoC container in general actually – LOL), it didn’t escape the XML configuration hassle. Again, that’s (unfortunately) a necessity for any IoC. For more information and examples on using Unity, check any of the following articles:

Create you own (Just for fun!!)

If you want to see how this thing from inside looks like, and you do not have time to investigate the source code of a sophisticated IoC container from any of the big players, check Ayende’s Building an IoC container in 15 lines of code article. But do not expect that to make you one more player :D.

You can also check how you can try achieving very basic functionality with the existing components of the BCL – that was before Unity of course :).

Share With Friends:

P.S. Please help me out by checking this offer, then look below for a small Thank You.

How did I learn that?

As a bonus for coming here, I'm giving away a free newsletter for web developers that you can sign up for from here.
It's not an anything-and-everything link list. It's thoughtfully collected picks of articles and tools, that focus on Angular 2, ASP.NET 5, and other fullstack developer goodies.

  • I had a desire to begin my company, however I did not have got enough of cash to do it. Thank heaven my colleague advised to take the loans. Therefore I used the secured loan and realized my old dream.