Stashbox by Peter Csajtai

<PackageReference Include="Stashbox" Version="5.8.2" />

 TenantDistributor

Represents a tenant distributor that manages tenants in a multi-tenant environment.

The container context.

public TenantDistributor(IStashboxContainer rootContainer = null)

Constructs a TenantDistributor.

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

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

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

Creates a new scope.

public TTo BuildUp<TTo>(TTo instance)

Builds up an existing instance. This means the container performs member and method injections on it without registering it into the container.

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

Checks whether a type can be resolved by the container, or not.

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

Checks whether a type can be resolved by the container, or not.

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

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

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

public void Configure(Action<ContainerConfigurator> config)

Configures the container.

public void ConfigureTenant(object tenantId, Action<IStashboxContainer> tenantConfig)

Adds a tenant with a specified service configuration to the distributor.

Creates a child container.

public void Dispose()

Returns all cached service resolution delegates.

Returns the details about the registrations.

Returns all registration mappings.

public object GetService(Type serviceType)

public IDependencyResolver GetTenant(object tenantId)

Gets a pre-configured IDependencyResolver from the distributor which represents a tenant identified by the given id. When the requested tenant doesn't exist a null value will be returned.

Calls the registered asynchronous initializers of all resolved objects.

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

Checks whether a type is registered in the container.

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

Checks whether a type is registered in the container.

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

Puts an instance into the scope. The instance will be disposed along with the scope disposal.

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

Registers a service into the container.

public IStashboxContainer Register<TFrom, TTo>(object name = null) where TTo : TFrom

Registers a service into the container with a name.

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

Registers a service into the container.

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

Registers a service into the container.

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

Registers a service into the container.

public IStashboxContainer Register<TTo>(object name = null)

Registers a service into the container.

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

Registers a service into the container.

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

Registers a decorator service into the container.

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

Registers a decorator service into the container.

Registers a decorator service into the container. This function configures the registration with the AsImplementedTypes option.

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

Registers a decorator service into the container. This function configures the registration with the AsImplementedTypes option.

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

Registers a decorator service into the container.

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

Registers a service with a factory resolver.

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

Registers a service with a factory resolver.

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

Registers a service with a factory resolver.

public IStashboxContainer RegisterFunc<T1, T2, T3, TService>(Func<T1, T2, T3, IDependencyResolver, TService> factory, object 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, object 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.

public IStashboxContainer RegisterScoped<TFrom, TTo>(object name = null) where TTo : TFrom

Registers a named service with scoped lifetime.

public IStashboxContainer RegisterScoped(Type typeFrom, Type typeTo, object name = null)

Registers a named service with scoped lifetime.

public IStashboxContainer RegisterScoped<TTo>(object name = null)

Registers a named service with scoped lifetime.

public IStashboxContainer RegisterSingleton<TFrom, TTo>(object name = null) where TTo : TFrom

Registers a named service with singleton lifetime.

public IStashboxContainer RegisterSingleton<TTo>(object name = null)

Registers a named service with singleton lifetime.

public IStashboxContainer RegisterSingleton(Type typeFrom, Type typeTo, object name = null)

Registers a named service with singleton lifetime.

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

Registers a collection of types into the container.

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

Registers a collection of types mapped to a service 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)

Resolves an instance from the container.

public object Resolve(Type typeFrom, object[] dependencyOverrides)

Resolves an instance from the container with dependency overrides.

public object Resolve(Type typeFrom, object name)

Resolves a named instance from the container.

public object Resolve(Type typeFrom, object name, object[] dependencyOverrides)

Resolves a named instance from the container with dependency overrides.

public IEnumerable<TKey> ResolveAll<TKey>()

Resolves all registered implementations of a service.

public IEnumerable<TKey> ResolveAll<TKey>(object name)

Resolves all registered implementations of a service identified by a name.

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

Resolves all registered implementations of a service with dependency overrides.

public IEnumerable<TKey> ResolveAll<TKey>(object name, object[] dependencyOverrides)

Resolves all registered implementations of a service identified by a name and with dependency overrides.

public IEnumerable<object> ResolveAll(Type typeFrom)

Resolves all registered implementations of a service.

public IEnumerable<object> ResolveAll(Type typeFrom, object name)

Resolves all registered implementations of a service.

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

Resolves all registered implementations of a service with dependency overrides.

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

Resolves all registered implementations of a service with dependency overrides.

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

Returns a factory delegate that can be used to activate the service.

public Delegate ResolveFactoryOrDefault(Type typeFrom, object name = null, Type[] parameterTypes)

Returns a factory delegate that can be used to activate the service or returns default if the type is not resolvable.

public object ResolveOrDefault(Type typeFrom)

Resolves an instance from the container or returns default if the type is not resolvable.

public object ResolveOrDefault(Type typeFrom, object[] dependencyOverrides)

Resolves an instance from the container with dependency overrides or returns default if the type is not resolvable.

public object ResolveOrDefault(Type typeFrom, object name)

Resolves a named instance from the container or returns default if the type is not resolvable.

public object ResolveOrDefault(Type typeFrom, object name, object[] dependencyOverrides)

Resolves an instance from the container with dependency overrides or returns default if the type is not resolvable.

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.