DI with Castle Windors, Parts I-IV

Simone Busoli has completed his series on dependency injection (link to last part, but each part includes links and summary of the other previous parts) with Castle Windsor’s Inversion of Control open source project. This is a fantastic set of blog posts!!!

I’m probably biased toward Castle because I’m hooked on all their offerings as it’s been posted here more than once 🙂

But I find that Windsor is very well done. It offers both constructor and setter injection models. It can be used at runtime or through the configuration files. I use this container in several of my development projects. ie. I use Windsor with my asp.net solution to handle the management of my DAO layer (DaoFactory : IDao).

This last article covers aspects I was unaware of, including how the ‘lifestyles’ work, as well as a fantastic start on how to extend Windsor with ‘facilities'(I’ve been looking for a good factory pattern setup with Windsor!). Simone create a FactorySupport facility, that is based on the factory method design pattern and walks through the steps:

“By registering the FactorySupport facility you have indirectly extended the container with a full new API which lets you use a new syntax to configure components and benefit from the facility “

It’s good to see these contribution blogs. I’d like to see the Microsoft Patterns and practices team embrace and use Windsor, I think it’s a step up from their ObjectBuilder…. but that is another post (or rather rant?) … I’ll let you go read the article 🙂


I had asked Simon how Windsor can handle a factory method that determines the type of object to create at runtime. He was gracious enough to give me a link to an article called ‘Referencing Implementations by Key’ (from BitterCoder)

BitterCode has a wiki that has Container Tutorials here 


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s