public class ServiceThatProvidesDep
{
public Dep GetDep()
{
// return dep object
}
}
public class ServiceThatConsumesDep
{
public ServiceThatConsumesDep(Dep dep)
{
// ...
}
}
以下是我认为安装程序的外观:
container.Register(Component.For<ServiceThatProvidesDep>());
container.Register(Component.For<Dep>().UsingService<ServiceThatProvidesDep>(s => s.GetDep()));