I have created a common static class for registering components solution wide.
private static readonly IWindsorContainer Container = new WindsorContainer();
public static void Register<I, T>() where T : I
{
Container.Register(
Component.For<I>().ImplementedBy<T>().LifeStyle.Transient
);
}
However, I am not able to compile it. Any ideas?
The type 'I' must be a reference type in order to use it as parameter 'TService' in the generic type or method 'Castle.MicroKernel.Registration.Component.For()'
As the warning indicates,
Ineeds to be a reference type so it requires a generic constraint to constrain it as suchYou may also want to look at using
IWindsorInstallertypes for registering components with the container and then register components with the container using the installersFor example
Then when instantiating the container