While locating an export the container will use the IInjectionContext interface to pass along information about the injection action being performed. As well as allowing the developer to pass custom information along the injection chain. By default a new InjectionContext will be created each time Locate is called, you can however create your own injection context and share it between multiple calls.


The TargetInfo property contains information about the injection being performed. Included in this information is the type of object being injected into, it's attributes, property or parameter info for the target, as well as attributes for the target.


The IInjectionContext implements the IExtraDataContainer that lets you store extra data in the context for use later in the injection chain. The container leverages this to implement the shared per injection feature.


To prevent the container from crashing with an endless loop when locate a circular dependency the context limits the depth that a locate can go. The default is a 1000, you should never hit that in normal operation but you can change that value if you want.


If an export implements IDisposable and is not marked as ExternallyOwned then it will be added to the disposal scope in the injection context. The DisposalScope can change during exporting depending on if the export has a lifecycle container attached to it.

Last edited Nov 17, 2013 at 7:48 PM by ipjohnson123, version 3