I have an interface and two classes that implements it. One of them has a parameter in its constructor. I have registered both of them as services in my app.config. Unfortunately I’m not able to resolve both of them in my code: the class with constructor is not returned.
E.g.:
interface ITest
{
}
class Test : ITest
{
private string a;
public Test(string a)
{
this.a = a;
}
}
class Test2 : ITest
{
}
Here is my configuration:
<castle>
<components>
<component id="Test" type="XYZ.Test, XYZ" service="XYZ.ITest, XYZ"/>
<component id="Test2" type="XYZ.Test2, XYZ" service="XYZ.ITest, XYZ"/>
</components>
</castle>
And here is how I try to get my services in code:
ITest[] resolveAll = container.ResolveAll<ITest>(new {a ="aText" });
The array “resolveAll” only contains ‘Test2’ but no trace of ‘Test’. How can I do to get these two classes ?
I note that if I resolve with id “Test”:
object resolve = container.Resolve("Test", new { sessionId = "sessionId" });
I obtain my ‘Test’ class.
What am I doing wrong ?
Actually I was on an old version of Castle Windsor. On last version (3.1), this works.