指定生活方式
Lifestyle 是如何城堡控制使用元件的範圍以及何時清理元件。內建的生活方式是 Singelton,Transient,PerWebRequest,Scoped,Bound,PerThread 和 Pooled
container.Register(
Component.For<IFoo>()
.ImplementedBy<Foo>()
.LifestyleSingleton(),
Component.For<IBar>()
.ImplementedBy<Bar>()
.LifestyleTransient());