I have this code:
using (container.BeginLifetimeScope())
{
RenderWord instruction = new RenderWord();
var instances = container.GetAllInstances<IInstructionHandler<RenderWord>>();
var firstInstance = result.First();
}
instances
is of type IEnumerable<IInstructionHandler<RenderWord>>
firstInstance
is of type IInstructionHandler<RenderWord>
that in reality is an instance of a decorator that decorates another decorator that decorates another decorator ...
At runtime the actual class instances
is of type ContainerControlledCollection<IInstructionHandler<RenderWord>>
and this ContainerControlledCollection
class holds a very useful piece of information - the underlying ImplementationType
.
Is there any way for me to get to the ContainerControlledCollection
or the producers[0].Value.ImplementationType
at runtime because I’d really like to be able to discover the base implementation type underneath the chain of decorators.
Handler
s can be plugged in at runtime and can be controlled/co-ordinated with database configuration - so just because aHandler
can be applied does not mean that it always will be applied. With all the benefits of the standard in-built decorators (tracing etc).