Mugen Injection [Strategy to resolve]
When you using a child container you can specify how bindings will be activated.
This code shows two strategy to activate binding:
public class SomeClass : ISomeInterface { public string Value { get; set; } public SomeClass(string value) { Value = value; } } const string parentValue = "parentValue"; const string childValue = "childValue"; using (var injector = GetInjector()) { injector.Bind<ISomeInterface>().To<SomeClass>(); injector.Bind<string>().ToConstant(parentValue); using (var child = (MugenInjector)injector.CreateChild()) { //override binding in child container. child.Bind<string>().ToConstant(childValue); //If not find binding, resolve in parent(use parent binding). injector.Settings.UseParentToResolve = true; var parentAlpha = injector.Get<ISomeInterface>(); var childAlpha = child.Get<ISomeInterface>(); parentAlpha.Value.ShouldEqual(parentValue); childAlpha.Value.ShouldEqual(parentValue); //changing flag child.Settings.UseParentToResolve = false; parentAlpha = injector.Get<ISomeInterface>(); childAlpha = child.Get<ISomeInterface>(); parentAlpha.Value.ShouldEqual(parentValue); childAlpha.Value.ShouldEqual(childValue); } }