Closed SuperJMN closed 4 years ago
@SuperJMN I'm leaving a comment just in case other people find this as we already discussed this offline.
The reason why the extra data is not used is because grace will attempt to concrete types first instead of looking in extra data. There are a couple ways to address this.
c.Configure(c => c.ExportFactory<IInjectionContext,DependencyA>(
context => context.GetExtraData('depA')));
Turn off auto registration. AutoRegisterUnknown = false
(probably not good for asp.net apps)
Use an interfaces instead of concrete type for parameter to constructor.
Do something specific with the DependencyB registration where you specify where A comes from.
Given this test, I expect
myClass
to be instatiated, but it's not. It tried to create an instance ofDependencyA
instead of the provided one (via ExtraData).