Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="3.2.2-preview-578" />

 StashboxContainer

Represents the Stashbox dependency injection container.

Stores the container context.

Constructs a StashboxContainer.

public object Activate(Type type, object[] arguments)

On the fly activates an object without registering it into the container. If you want to resolve a registered service use the Resolve instead.

public IDependencyResolver BeginScope(object name = null, bool attachToParent = false)

Begins a new scope.

public TTo BuildUp<TTo>(TTo instance)

Builds up an instance, the container will perform injections and extensions on it.

public bool CanResolve<TFrom>(object name = null)

Checks a type can be resolved by the container.

public bool CanResolve(Type typeFrom, object name = null)

Checks a type can be resolved by the container.

public IStashboxContainer ComposeBy(Type compositionRootType, object[] compositionRootArguments)

Composes services by calling the Compose method of the given type.

Composes services by calling the Compose method of the given root.

public void Configure(Action<ContainerConfigurator> config)

Configures the container.

Creates a child container.

public void Dispose()

Returns all registration mappings.

public object GetService(Type serviceType)

public bool IsRegistered<TFrom>(object name = null)

Checks a type is registered in the container.

public bool IsRegistered(Type typeFrom, object name = null)

Checks a type is registered in the container.

public IDependencyResolver PutInstanceInScope(Type typeFrom, object instance, bool withoutDisposalTracking = false, object name = null)

Puts an instance into the scope which will be dropped when the scope is being disposed.

public IStashboxContainer Register<TFrom, TTo>(Action<RegistrationConfigurator<TFrom, TTo>> configurator = null) where TTo : TFrom

Registers a type into the container with custom configuration.

public IStashboxContainer Register<TFrom>(Type typeTo, Action<RegistrationConfigurator<TFrom, TFrom>> configurator = null)

Registers a type into the container with custom configuration.

public IStashboxContainer Register(Type typeFrom, Type typeTo, Action<RegistrationConfigurator> configurator = null)

Registers a type into the container with custom configuration.

public IStashboxContainer Register<TTo>(Action<RegistrationConfigurator<TTo, TTo>> configurator = null)

Registers a type into the container with custom configuration.

public IStashboxContainer Register(Type typeTo, Action<RegistrationConfigurator> configurator = null)

Registers a type into the container with custom configuration.

public IStashboxContainer RegisterDecorator(Type typeFrom, Type typeTo, Action<DecoratorConfigurator> configurator = null)

Registers a decorator type into the container with custom configuration.

public IStashboxContainer RegisterDecorator<TFrom, TTo>(Action<DecoratorConfigurator<TFrom, TTo>> configurator = null) where TTo : TFrom

Registers a decorator type into the container with custom configuration.

public IStashboxContainer RegisterDecorator<TFrom>(Type typeTo, Action<DecoratorConfigurator<TFrom, TFrom>> configurator = null)

Registers a decorator type into the container with custom configuration.

public IStashboxContainer RegisterFunc<TService>(Func<IDependencyResolver, TService> factory, string name = null)

Registers a service with a factory resolver.

public IStashboxContainer RegisterFunc<T1, TService>(Func<T1, IDependencyResolver, TService> factory, string name = null)

Registers a service with a factory resolver.

public IStashboxContainer RegisterFunc<T1, T2, TService>(Func<T1, T2, IDependencyResolver, TService> factory, string name = null)

Registers a service with a factory resolver.

public IStashboxContainer RegisterFunc<T1, T2, T3, TService>(Func<T1, T2, T3, IDependencyResolver, TService> factory, string name = null)

Registers a service with a factory resolver.

public IStashboxContainer RegisterFunc<T1, T2, T3, T4, TService>(Func<T1, T2, T3, T4, IDependencyResolver, TService> factory, string name = null)

Registers a service with a factory resolver.

public IStashboxContainer RegisterInstance<TInstance>(TInstance instance, object name = null, bool withoutDisposalTracking = false, Action<TInstance> finalizerDelegate = null)

Registers an already constructed instance into the container.

public IStashboxContainer RegisterInstance(object instance, Type serviceType, object name = null, bool withoutDisposalTracking = false)

Registers an already constructed instance into the container.

public void RegisterResolver(IResolver resolver)

Registers an IResolver into the container.

public IStashboxContainer RegisterTypes(IEnumerable<Type> types, Func<Type, bool> selector = null, Action<RegistrationConfigurator> configurator = null)

Registers types into the container.

public IStashboxContainer RegisterTypesAs(Type typeFrom, IEnumerable<Type> types, Func<Type, bool> selector = null, Action<RegistrationConfigurator> configurator = null)

Registers types into the container mapped to an interface type.

public IStashboxContainer ReMap<TFrom, TTo>(Action<RegistrationConfigurator<TFrom, TTo>> configurator = null) where TTo : TFrom

Replaces an existing registration mapping.

public IStashboxContainer ReMap<TFrom>(Type typeTo, Action<RegistrationConfigurator<TFrom, TFrom>> configurator = null)

Replaces an existing registration mapping.

public IStashboxContainer ReMap(Type typeFrom, Type typeTo, Action<RegistrationConfigurator> configurator = null)

Replaces an existing registration mapping.

public IStashboxContainer ReMap<TTo>(Action<RegistrationConfigurator<TTo, TTo>> configurator = null)

Replaces an existing registration mapping.

public IStashboxContainer ReMapDecorator(Type typeFrom, Type typeTo, Action<DecoratorConfigurator> configurator = null)

Replaces an existing decorator mapping.

public IStashboxContainer ReMapDecorator<TFrom, TTo>(Action<DecoratorConfigurator<TFrom, TTo>> configurator = null) where TTo : TFrom

Replaces an existing decorator mapping.

public IStashboxContainer ReMapDecorator<TFrom>(Type typeTo, Action<DecoratorConfigurator<TFrom, TFrom>> configurator = null)

Replaces an existing decorator mapping.

public object Resolve(Type typeFrom, bool nullResultAllowed = false, object[] dependencyOverrides = null)

Resolves an instance from the container.

public object Resolve(Type typeFrom, object name, bool nullResultAllowed = false, object[] dependencyOverrides = null)

Resolves an instance from the container.

public IEnumerable<TKey> ResolveAll<TKey>(object[] dependencyOverrides = null)

Resolves all registered types of a service.

public IEnumerable<object> ResolveAll(Type typeFrom, object[] dependencyOverrides = null)

Resolves all registered types of a service.

public Delegate ResolveFactory(Type typeFrom, object name = null, bool nullResultAllowed = false, Type[] parameterTypes)

Returns a factory method which can be used to activate a type.

public void Validate()

Validates the current state of the container.

public IStashboxContainer WireUp<TInstance>(TInstance instance, object name = null, bool withoutDisposalTracking = false, Action<TInstance> finalizerDelegate = null)

Registers an already constructed instance, but the container will perform injections and extensions on it.

public IStashboxContainer WireUp(object instance, Type serviceType, object name = null, bool withoutDisposalTracking = false)

Registers an already constructed instance, but the container will perform injections and extensions on it.