Currently, the container picks every decorator with the same service type during resolution. It would be great to add more control over the decorator selection like:
class A : IService { }
class B : IService { }
class ADecorator : IService {}
class ServiceDecorator : IService {}
container
.Register<IService, A>("A")
.Register<IService, B>("B")
.RegisterDecorator<IService, ServiceDecorator>()
.RegisterDecorator<IService, ADecorator>(config => config.When(typeInfo => typeInfo.Type == typeof(A)));
container.Resolve<IService>("A"); // new ADecorator(new ServiceDecorator(new A()));
container.Resolve<IService>("B"); // new ServiceDecorator(new B());
Currently, the container picks every decorator with the same service type during resolution. It would be great to add more control over the decorator selection like: