Given these classes:
public class MyDependency {}
public class MyStartable : IStartable
{
public MyStartable(MyDependency dep) {}
public void Start() { Console.WriteLine("MyStartable started"); }
public void Stop() { Console.WriteLine("MyStartable stopped"); }
}
and this registration code:
WindsorContainer container = new WindsorContainer();
container.AddFacility<StartableFacility>();
container.Register(Component.For<MyStartable>());
why does calling this code:
container.Register(Component.For<MyDependency>());
not cause MyStartable to be started (unless it is explicitly resolved), but calling this code:
container.AddComponent<MyDependency>();
does result in MyStartable being started?
I expected MyStartable to be started in the first case, and was thinking that it might be a bug. I started to add a test case for it, and that's when I discovered that the AddComponent() version worked the way I expected. Is it intended that these two registration methods behave differently, and if so, is there any documentation about the differences?
Thanks,
Michael Davis