I have a set of services that I want to register with Castle Windsor (version 3.0 RC1) using the free registration technique.
I want all of them, except one, to use a temporary lifestyle, and I want to be single, so I do this:
container.Register(AllTypes .FromThisAssembly() .InSameNamespaceAs<IMyService>() .WithServiceDefaultInterfaces() .ConfigureIf(s => s.Implementation == typeof(MyService), s => s.LifestyleSingleton(), s => s.LifestyleTransient()));
The problem with this is that I use typeof ( MyService ) in the first ConfigureIf parameter, but I would prefer that I could use IMyService to determine if it is single or not (i.e. it doesn't matter what the implementation is , it should always be singleton). Is it possible?
source share