Say I have a component like this
public class MyComponent
{
public MyComponent(string name)
{
}
}
I basically want to have the provided constructor parameters behave as part of the component identifier when resolving it. If you've never resolved it with that set of parameters, it will instantiate a new one.
In other words, I want to somehow modify the following test to succeed:
IWindsorContainer container = new WindsorContainer();
container.Register(Component.For<MyComponent>());
MyComponent a1 = container.Resolve<MyComponent>(new { name = "a" });
MyComponent a2 = container.Resolve<MyComponent>(new { name = "a" });
MyComponent b = container.Resolve<MyComponent>(new { name = "b" });
Assert.AreSame(a1, a2);
Assert.AreNotSame(a1, b);
Currently it fails because it will instantiate with name=a, then return the same object for all future name=a and name=b.
Thanks!