Is is possible with the Castle Windsor Container to have one component implement two different interfaces and then when resolving it to return the same component instance? For example;
var windsor = new WindsorContainer()
.AddComponent<InterfaceA, ClassAB>()
.AddComponent<InterfaceB, ClassAB>();
var classAB1 = windsor.Resolve<InterfaceA>();
var classAB2 = windsor.Resolve<InterfaceB>();
Assert.AreSame(classAB1, classAB2);
If I try this as shown I get an exception with the message There is a component already registered for the given key, if I provide different keys then it returns two separate instances of the class ClassAB
.
Edit: Ideally I would like to do this in a config file.