public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine configArgs) { configArgs.OnStartupComplete += () => { // hack: needed for injecting func params #if LIGHTINJECT_LOCATOR if (registry.InternalContainer is LightInject.IServiceContainer lightInjectContainer) { lightInjectContainer.RegisterConstructorDependency((factory, info, runtimeArgs) => (IInjectable)(runtimeArgs[0])); } #elif LAMAR_LOCATOR if (registry.InternalContainer is Lamar.Container lamarContainer) { lamarContainer.Configure(c => { c.AddTransient((provider) => { return(new System.Func <IInjectable, TestFuncCreationComplex>( (i) => new TestFuncCreationComplex(i, provider.GetService(typeof(IStartupConfiguration)) as IStartupConfiguration, provider.GetService(typeof(IShutdownHandler)) as IShutdownHandler) )); }); }); } #endif }; }
void ILocatorConfigure.Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { if (RegisterScopedHttpContext) { registry.Add(typeof(System.Web.HttpContextBase), _ => new System.Web.HttpContextWrapper(System.Web.HttpContext.Current), Lifecycle.Scoped); } }
void ILocatorConfigure.Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { engine.OnLocatorStartupComplete += () => { IEnumerable <Type> renderingTypes = engine.Configuration .AssemblyScanner.GetTypesFor(typeof(RenderingDocumentAliasAttribute)); foreach (var rendering in renderingTypes.Where(x => !x.IsAbstract() && !x.IsInterface())) { registry?.Add(rendering, rendering, lifecycle: Lifecycle.Transient); } }; }
void ILocatorConfigure.Configure(ILocatorRegistry registry, ILocatorConfigureEngine args) { var scannedRegistrations = args.Configuration.AssemblyScanner.GetTypesFor(RegistrationType); var registrations = args.Configuration.DependencySorter .Sort <RegistrationAttribute>(scannedRegistrations.OfType <object>()) .SelectMany(ConvertNodeToRegistration) .ToList(); args.Configuration.RegistrationsModifier?.Modify(registrations); registrations.All(r => AddRegistration(r, registry)); args.Configuration.Environment.Items.Set <ICollection <Registration> >(registrations); }
void ILocatorConfigure.Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { engine.OnLocatorStartupComplete += () => { IApiControllerRegistrationSetup controllerRegistrationSetup = GetApiControllerRegistrationSetup?.Invoke() ?? new ApiControllerRegistrationSetup(); if (controllerRegistrationSetup.EnableApiControllerRegistrations == true) { IEnumerable <Type> controllerTypes = engine.Configuration.AssemblyScanner.GetTypesFor(typeof(ApiController)); foreach (var controller in controllerTypes.Where(x => x.IsAbstract == false)) { registry?.Add(controller, controller, lifecycle: Lifecycle.Transient); } } }; }
public void Configure(ILocatorRegistry container, ILocatorConfigureEngine engine) { try { container.Add(typeof(IRemove), typeof(BaseImpl), null, Lifecycle.Singleton); } catch { RegisterException = true; } if (container is ILocatorRegistryWithRemove removable) { removable.Remove(typeof(IRemove)); SupportsServiceRemoval = true; } container.Add <BaseTest, BaseImpl>(lifecycle: Lifecycle.Singleton); container.Add(typeof(IFooTwo), locator => FooTwoFactory.CreateFoo(), Lifecycle.Transient); }
public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { var x = DotNetStarter.ApplicationContext.Default; }
public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine configArgs) { configArgs.Configuration.Environment.Items.Set <StringBuilder>(new StringBuilder()); configArgs.Configuration.Environment.Items.Get <StringBuilder>().AppendLine("Configured Item!"); }
public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { registry.Add <TestFoo, TestFoo>(); }
void ILocatorConfigure.Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { AddServicesToLocator(_serviceCollection, registry); }
public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { throw new NotImplementedException(); }
public void Configure(ILocatorRegistry container, ILocatorConfigureEngine engine) { engine.OnLocatorStartupComplete += Engine_OnContainerStarted; }
public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { Executed = true; }
public void Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { engine.OnLocatorStartupComplete += () => FiredLocator = true; engine.OnStartupComplete += () => FiredStartup = true; }
void ILocatorConfigure.Configure(ILocatorRegistry registry, ILocatorConfigureEngine engine) { // use scoped to not create many per web request, also cannot use given locator to resolve scoped items registry.Add(typeof(UmbracoContext), locator => EnsureUmbracoContext(), Lifecycle.Scoped); registry.Add(typeof(UmbracoHelper), locator => new UmbracoHelper(EnsureUmbracoContext()), Lifecycle.Scoped); }