« ASP.NET MVC Keyboard Shortcuts in Visual Studio | Main | Sarasota Web Developer Group Forming »

01/10/2010

Comments

Feed You can follow this conversation by subscribing to the comment feed for this post.

Nicholas Blumhardt

Great article - this is the first time I've seen the design of your new site, very slick!

There's a typo in the second example, the LazyDependencyModule is still being registered but it is not required.

It's worth adding that this feature has a strong resemblance to MEF's PartCreator http://blogs.msdn.com/nblumhardt/archive/2009/08/28/dynamic-part-instantiation-in-mef.aspx. PartCreator goes a step further by providing Lazy-style metadata on factories, but doesn't support parameterisation. Even if you're not a MEF user, it is worth beating down the door of the MEF team http://mef.codeplex.com to get this into a desktop release ASAP. Just like Lazy, once PartCreator is in the framework, other IoC containers like Autofac and Unity will be able to support it as well.

Cheers!

David Hayden

Great point! I forgot to remove the LazyDependencyModule, which is not necessary for Func, only Lazy when dealing with .NET 4.

I modified the code above per your comment.

Thanks!

The comments to this entry are closed.