How can I configure NServiceBus to inject decorated classes correctly?
Imagine this scenario:
public class A
{
public IDependency Dependency {get;set;}
}
public class B : IDependency
{
public IDependency DecoratedDependency {get; set;}
}
public class C : IDependency{}
I want to set up my config so that B is created with C injected, and then A is created with B injected. I don't want A created with C injected.
How do I set the config up so that it does this? It feels like I should use something along the lines of:
Configure.Instance.Configurer
.ConfigureComponent<B>(...)
.ConfigureProperty(x=>x.DecoratedDependency, instanceOfCFromTheContainer);
Configure.Instance.Configurer
.ConfigureComponent<A>(...)
.ConfigureProperty(x=>x.Dependency, instanceOfBFromTheContainer);
but I'm not sure how I refer to those instances? And how do I ensure that C is only used for B's property and that B is used everywhere else when the container does its resolution?
Or do I need to do something different?