Just sharing some of my inconsequential lunch conversations with you... RSS  

Sunday, February 03, 2008

Unity

Unity is the name of the DI container that is being built for Enterprise Library 4 - yeap, finally Microsoft is getting strong naming for their products, it was born as DIAB, DI Application Block.

Here's a typical usage scenario:

UnityContainer container = new UnityContainer()
.Register<ILogger, TraceLogger>()
.Register<ISomething, Something>()
.Register<ISomethingElse, SomethingElse>();

ILogger logger = container.Get<ILogger>();

logger.Write("log something", new string[] {"category1", "category2"});


A little more verbose version of the factory abstraction, but definitely a clear one. But above all:



It opens up the software factories and Enterprise Library to something other than ObjectBuilder and allow us to use our DI Tool of choice - whether that be the DIAB or another tool.

No comments:

Development Catharsis :: Copyright 2006 Mário Romano