Creating a simple Windsor facility
April 11, 2007
Update: What this facility accomplishes is easily done using property setter injection in Windsor. Please use this post only as an example for creating a basic, yet misguided, facility. Windsor is an excellent inversion of control (IoC) container. Besides putting components into the container for use with dependency injection you can extend, customize, tweak, spindle, the behaviors of the container by adding facilities. Facilities expose events and information about what is going on with the container such as what is being added to it and what objects are being created by it. This viewport into the container lets you inject behavior into the lifecycle of objects springing forth from the container. All of this at first is very confusing but lends itself to powerful capabilities. The exercise I went through was to provide a TimeService as an aspect of our application. Normally developers use DateTime.Now…