Windsor Container Property Setter Injection
April 30, 2007
Hammet pointed out in the comments for Creating a simple Windsor facility that the whole premise of my TimeServiceFacility is silly. Sorry, but I still don't get it why you used a facility to do that. You could get the same behavior by - registering the timeservice as, well, a service - having writable properties on components, like you do on HasTimeServiceProperty class. it will be "injected" in the same way. Interesting exercise, though. This post is an attempt to correct a wrong. Windsor will do Property setter injection out of the box. Just follow what Hammet said to do a viola you get the same thing. Add the TimeService as service component to the container: Container.Current.AddComponent('timeservice', typeof(ITimeService), typeof(TimeService)); Here is a test that proves setter injection is working for components resolved from the container…