castle-windsor Specifying Lifestyle


Example

A Lifestyle is the "how" Castle controls the scope in which a component is used and when to clean it up. The built-in lifestyles are Singelton, Transient, PerWebRequest, Scoped, Bound, PerThread and Pooled

container.Register(
   Component.For<IFoo>()
            .ImplementedBy<Foo>()
            .LifestyleSingleton(),

    Component.For<IBar>()
             .ImplementedBy<Bar>()
             .LifestyleTransient());