• Manual
  • Scripting API
  • Changelog
  • License
Show / Hide Table of Contents
  • AlchemyBow.Core
    • CoreController<TProjectContext>
    • CoreProjectContext
    • ICoreLoadable
    • ICoreLoadingCallbacksHandler
    • LoadablesProgress
    • OperationHandle
  • AlchemyBow.Core.Editor.Utilities
    • CoreEditorUtility
    • IndentStringBuilder
  • AlchemyBow.Core.Editor.Windows
    • CoreManagementWindow
  • AlchemyBow.Core.Editor.Wizards
    • CoreControllerScriptWizard
    • CoreProjectContextPrefabWizard
    • CoreProjectContextScriptWizard
    • CoreQuickStartWizard
    • ValidationMessageList
    • WizardValidationUtility
    • WizardWindow
  • AlchemyBow.Core.Extras.Behaviours
    • CoreBehaviour
    • CoreBehaviourEnablingStrategy
  • AlchemyBow.Core.Extras.FluentBindings
    • ContainerFluentExtensions
    • FluentBinding
  • AlchemyBow.Core.Extras.Installers
    • ChildrenCompositeMonoInstaller
    • UnityObjectMonoInstaller
  • AlchemyBow.Core.IoC
    • Container
    • DynamicCollectionBindingUtility
    • DynamicInjector<T>
    • IBindOnlyContainer
    • InjectAttribute
    • InjectionTargetAttribute
    • MonoInstaller
  • AlchemyBow.Core.IoC.Elements
    • DynamicInjectorBase
    • InjectionInfo
    • ReflectionFieldsSetter
  • AlchemyBow.Core.States
    • ICondition
    • IState
    • StateGraph
    • StateGraphComposer
  • AlchemyBow.Core.States.Elements
    • StateGraphLink
  • AlchemyBow.Core.States.Prototyping
    • PrototypeCondition
    • PrototypeState

Class Container

Represents a dependency injection container.

Inheritance
object
Container
Implements
IBindOnlyContainer
Namespace: AlchemyBow.Core.IoC
Assembly: AlchemyBow.Core.dll
Syntax
public sealed class Container : IBindOnlyContainer

Constructors

Container()

Creates an instance of the class.

Declaration
public Container()

Methods

AddRangeToDynamicCollectionBinding<TCollection, TItem>(IEnumerable<TItem>)

Ensures that there is a key-value pair for the dynamic collection and adds specified items.

Declaration
public void AddRangeToDynamicCollectionBinding<TCollection, TItem>(IEnumerable<TItem> items) where TCollection : ICollection<TItem>
Parameters
Type Name Description
IEnumerable<TItem> items

The items to add.

Type Parameters
Name Description
TCollection

The key of the dynamic collection.

TItem

The type of items in the collection.

Remarks

Informs the container that it should inject dependencies to the instance of the collection but not into the items. (The dependencies are injected during the resolve process.)

AddToDynamicCollectionBinding<TCollection, TItem>(TItem)

Ensures that there is a key-value pair for the dynamic collection and adds the specified item.

Declaration
public void AddToDynamicCollectionBinding<TCollection, TItem>(TItem item) where TCollection : ICollection<TItem>
Parameters
Type Name Description
TItem item

The item to add.

Type Parameters
Name Description
TCollection

The key of the dynamic collection.

TItem

The type of items in the collection.

Remarks

Informs the container that it should inject dependencies to the instance of the collection but not into the item. (The dependencies are injected during the resolve process.)

Bind(Type, object)

Declares a new key-value pair and informs the container that it should inject dependencies to the instance of the value.

Declaration
public void Bind(Type key, object value)
Parameters
Type Name Description
Type key

The key.

object value

The instance of the value.

Remarks

The dependencies are injected during the resolve process.

BindInaccessible(object)

Informs the container that it should inject dependencies to the instance.

Declaration
public void BindInaccessible(object instance)
Parameters
Type Name Description
object instance

The instance to inform about.

Remarks

The dependencies are injected during the resolve process.

Bind<TKey>(TKey)

Declares a new key-value pair and informs the container that it should inject dependencies to the instance of the value.

Declaration
public void Bind<TKey>(TKey value)
Parameters
Type Name Description
TKey value

The instance of the value.

Type Parameters
Name Description
TKey
Remarks

The dependencies are injected during the resolve process.

CopyContent(Container, Container, bool)

Copies the content of the source container to the target container.

Declaration
public static void CopyContent(Container source, Container target, bool sealDynamicCollections)
Parameters
Type Name Description
Container source

The source container.

Container target

The target container.

bool sealDynamicCollections

If true, converts dynamic collection bindings into standard binding in the target container.

EnsureDynamicCollectionBinding<TCollection>()

Ensures that there is a key-value pair for the dynamic collection.

Declaration
public void EnsureDynamicCollectionBinding<TCollection>()
Type Parameters
Name Description
TCollection

The key of the dynamic collection.

ResolveAllBindings()

Resolves all bindings.

Declaration
public void ResolveAllBindings()

Resolve<T>()

Resolves the specified key.

Declaration
public T Resolve<T>()
Returns
Type Description
T

The resolved value that was associated to the key.

Type Parameters
Name Description
T

The key to resolve.

Implements

IBindOnlyContainer

Extension Methods

ContainerFluentExtensions.StartFluentBinding(IBindOnlyContainer, object)
DynamicCollectionBindingUtility.AddRangeToDynamicDictionaryBinding<TKey, TValue>(IBindOnlyContainer, IEnumerable<KeyValuePair<TKey, TValue>>)
DynamicCollectionBindingUtility.AddRangeToDynamicHashSetBinding<TItem>(IBindOnlyContainer, IEnumerable<TItem>)
DynamicCollectionBindingUtility.AddRangeToDynamicListBinding<TItem>(IBindOnlyContainer, IEnumerable<TItem>)
DynamicCollectionBindingUtility.AddToDynamicDictionaryBinding<TKey, TValue>(IBindOnlyContainer, KeyValuePair<TKey, TValue>)
DynamicCollectionBindingUtility.AddToDynamicDictionaryBinding<TKey, TValue>(IBindOnlyContainer, TKey, TValue)
DynamicCollectionBindingUtility.AddToDynamicHashSetBinding<TItem>(IBindOnlyContainer, TItem)
DynamicCollectionBindingUtility.AddToDynamicListBinding<TItem>(IBindOnlyContainer, TItem)
In this article
Back to top Copyright © 2022-2024 AlchemyBow | Generated by DocFX