main
1using Castle.Core;
2using Castle.MicroKernel.Registration;
3
4namespace gorilla.commons.infrastructure.thirdparty.Castle.Windsor.Configuration
5{
6 public class ConfigureComponentLifestyle : RegistrationConfiguration
7 {
8 public void configure(ComponentRegistration registration)
9 {
10 var implementation = registration.Implementation;
11 if (implementation.GetCustomAttributes(typeof (SingletonAttribute), false).Length > 0)
12 {
13 registration.LifeStyle.Is(LifestyleType.Singleton);
14 }
15 registration.LifeStyle.Is(LifestyleType.Transient);
16 }
17 }
18}