private protected IProvidedValue <TService> CreateProvidedValue <TService>(Func <IComponentContext, TService> factory) { var value = new ProvidedValue <TService>(factory); _afterBuildActions.Add(c => value.SetComponentContext(c)); return(value); }
/// <summary> /// Allows a way to access the services being configured that the container will provide. /// </summary> /// <param name="service">Parameter to obtain the substituted value.</param> /// <returns></returns> public SubstituteForBuilder2 <TService> Provide(out IProvidedValue <TService> service) { var provided = new ProvidedValue <TService>(); _builder.ConfigureBuilder(b => { b.RegisterBuildCallback(scope => { provided.Value = scope.Resolve <TService>(); }); }); service = provided; return(this); }