You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently when a type can not be located the IInjectionContext will be checked to see if it can be resolved. Expanding this to IExportLocatorScope allows the lifetime scope to be used in even more complex scenarios.
I see the use case as providing simple keyed values (string, int, etc)
[Fact]
public void LifetimeScope_Backup_Resolution_Source_With_Name()
{
var container = new DependencyInjectionContainer();
using (var scope = container.BeginLifetimeScope(extraData: new { value = 5 }))
{
var instance = scope.Locate<DependentService<int>>();
Assert.NotNull(instance);
Assert.Equal(5, instance.Value);
}
}
Activity
ipjohnson commentedon Feb 12, 2017