Search code examples
inversion-of-controlcastle-windsorioc-container

Can the default lifestyle of Castle Windsor registered components be changed?


The Castle Windsor documentation shows that Singleton is the default lifestyle for registered components.

Is it possible to change the default lifestyle such that by default, a registered component will have a transient lifestyle?


Solution

  • Not sure if possible or not but what you can do is add an "IContributeComponentModelConstruction" to set all components to a specific lifestyle.

    Check this: http://blog.ploeh.dk/2010/04/26/ChangingWindsorlifestylesafterthefact/