Windsor Container - Bug
Today run into what I think is a bug in Windsor Container. After googling a bit, found a post that is similar to what I have - need to have a constructor in implementer component (ctor(string)) and configure Windsor to call it, rather than overloaded version of constructor. For some reason Windsor is not going to the default constructor.
1: public interface IService
2: {
3: //...
4: }
5:
6: class Component : IService
7: {
8: public Component() : this(DependencyResolver<IService>()) {}
9: public Component(IService service){}
10: }
The component was registered as:
1: var type = typeof(IService);
2: DependencyResolver.Register(type.FullName, type, typeof(Component));
the proposed workaround was :
1: class Component : IService
2: {
3: public Component(string ignored) this() {} // call default ctor
4: public Component() : this(DependencyResolver<IService>()) {}
5: public Component(IService service){}
6: }
and through Container.Kernel.Handler register Dictionary of parameters (string in this case) that would determine what constructor to use.
Has anyone solved this problem in a more delicate way rather that creating a workaround constructor and registering parameters?