public static void Configure(this ContainerCustomizations customizations, IMessageBusContainer container, IMessageBusConfiguration configuration) { customizations.Settings.Set("MessageBusContainer", container); customizations.Settings.Set("MessageBusConfiguration", configuration); var nativeContainer = container.NativeContainer; if (nativeContainer is IKernel) { customizations.Settings.Set("ExistingKernel", nativeContainer); } else if (nativeContainer is IUnityContainer) { customizations.Settings.Set("ExistingContainer", nativeContainer); } }
/// <summary> /// Use the a pre-configured SimpleInjector contains /// </summary> /// <param name="customizations"></param> /// <param name="container">The existing container to use.</param> public static void UseExistingContainer(this ContainerCustomizations customizations, global::SimpleInjector.Container container) { if (!container.Options.AllowOverridingRegistrations) { throw new ArgumentException("Invalid container configuration - must set Options.AllowOverridingRegistrations to true"); } if (!(container.Options.DefaultScopedLifestyle is AsyncScopedLifestyle)) { throw new ArgumentException("Invalid container configuration - must set DefaultScopedLifestyle to AsyncScopedLifestyle"); } if (!(container.Options.PropertySelectionBehavior is ImplicitPropertyInjectionExtensions.ImplicitPropertyInjectionBehavior)) { throw new ArgumentException("Invalid container - must set properties to be autowired (by calling Options.AutoWirePropertiesImplicitly())"); } customizations.Settings.Set <ContainerHolder>(new ContainerHolder(container)); }
/// <summary> /// Use the a pre-configured AutoFac lifetime scope. /// </summary> /// <param name="customizations"></param> /// <param name="lifetimeScope">The existing lifetime scope to use.</param> public static void ExistingLifetimeScope(this ContainerCustomizations customizations, ILifetimeScope lifetimeScope) { customizations.Settings.Set <AutofacBuilder.LifetimeScopeHolder>(new AutofacBuilder.LifetimeScopeHolder(lifetimeScope)); }
/// <summary> /// Use a pre-configured Ninject kernel /// </summary> /// <param name="customizations"></param> /// <param name="kernel">The existing container instance.</param> public static void ExistingKernel(this ContainerCustomizations customizations, IKernel kernel) { customizations.Settings.Set <NinjectBuilder.KernelHolder>(new NinjectBuilder.KernelHolder(kernel)); }
public static ContainerCustomizations ServiceProviderFactory(this ContainerCustomizations customizations, Func <IServiceCollection, IServiceProvider> providerFactory) { customizations.Settings.Set(FactoryKey, providerFactory); return(customizations); }
public static ContainerCustomizations UseServiceCollection(this ContainerCustomizations customizations, IServiceCollection serviceCollection) { customizations.Settings.Set <IServiceCollection>(serviceCollection); return(customizations); }
/// <summary> /// Use the a pre-configured <see cref="IUnityContainer"/>. /// </summary> public static void UseExistingContainer(this ContainerCustomizations customizations, IUnityContainer existingContainer) { customizations.Settings.Set <UnityBuilder.ContainerHolder>(new UnityBuilder.ContainerHolder(existingContainer)); }
public static void ExistingContainer(this ContainerCustomizations customizations, StructureMap.IContainer container) { customizations.Settings.Set("ExistingContainer", container); }
public static void ServiceProviderFactory(this ContainerCustomizations customizations, Func <IServiceCollection, UpdateableServiceProvider> serviceProviderFactory) { customizations.Settings.Set <Func <IServiceCollection, UpdateableServiceProvider> >(serviceProviderFactory); }
/// <summary> /// Use a pre-configured service collection. /// </summary> /// <param name="customizations"></param> /// <param name="services">The existing service collection.</param> public static void ExistingServices(this ContainerCustomizations customizations, IServiceCollection services) { customizations.Settings.Set <ServicesBuilder.CollectionHolder>(new ServicesBuilder.CollectionHolder(services)); }
/// <summary> /// Use the a pre-configured AutoFac lifetime scope. /// </summary> /// <param name="customizations"></param> /// <param name="lifetimeScope">The existing lifetime scope to use.</param> public static void ExistingLifetimeScope(this ContainerCustomizations customizations, ILifetimeScope lifetimeScope) { customizations.Settings.Set("ExistingLifetimeScope", lifetimeScope); }
/// <summary> /// Use the a pre-configured <see cref="IUnityContainer"/>. /// </summary> public static void UseExistingContainer(this ContainerCustomizations customizations, IUnityContainer existingContainer) { customizations.Settings.Set("ExistingContainer", existingContainer); }
/// <summary> /// Use a pre-configured native Windsor container. /// </summary> /// <param name="customizations"></param> /// <param name="container">The existing container instance.</param> public static void ExistingContainer(this ContainerCustomizations customizations, IWindsorContainer container) { customizations.Settings.Set <WindsorBuilder.ContainerHolder>(new WindsorBuilder.ContainerHolder(container)); }