StrangeIoC  0.6.0
The IoC/Binding Framework for Unity3D and C#
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | Properties | List of all members
strange.extensions.injector.api.IInjectionBinding Interface Reference

The Binding form for the Injection system. More...

Inheritance diagram for strange.extensions.injector.api.IInjectionBinding:
strange.framework.api.IBinding strange.extensions.injector.impl.InjectionBinding

Public Member Functions

IInjectionBinding ToSingleton ()
 Map the Binding to a Singleton so that every GetInstance() on the Binder Key returns the same imstance.
 
IInjectionBinding ToValue (object o)
 Map the Binding to a stated instance so that every GetInstance() on the Binder Key returns the provided imstance. Sets type to Value.
 
IInjectionBinding SetValue (object o)
 Map the Binding to a stated instance so that every GetInstance() on the Binder Key returns the provided imstance. Does not set type.
 
IInjectionBinding CrossContext ()
 Map the binding and give access to all contexts in hierarchy.
 
IInjectionBinding ToInject (bool value)
 Boolean setter to optionally override injection. If false, the instance will not be injected after instantiation.
 
new IInjectionBinding Bind< T > ()
 Bind is the same as Key, but permits Binder syntax: Bind<T>().Bind<T>()
 
new IInjectionBinding Bind (object key)
 Bind is the same as Key, but permits Binder syntax: Bind<T>().Bind<T>()
 
new IInjectionBinding To< T > ()
 Set the Binding's value to a Type.
 
new IInjectionBinding To (object o)
 Set the Binding's value to a value, such as a string or class instance.
 
new IInjectionBinding ToName< T > ()
 Qualify a binding using a marker type.
 
new IInjectionBinding ToName (object o)
 Qualify a binding using a value, such as a string or class instance.
 
new IInjectionBinding Named< T > ()
 Retrieve a binding if the supplied name matches, by Type.
 
new IInjectionBinding Named (object o)
 Retrieve a binding if the supplied name matches, by value.
 
- Public Member Functions inherited from strange.framework.api.IBinding
void RemoveKey (object o)
 Remove a specific key from the binding.
 
void RemoveValue (object o)
 Remove a specific value from the binding.
 
void RemoveName (object o)
 Remove a name from the binding.
 
IBinding Weak ()
 

Properties

bool isCrossContext [get]
 
bool toInject [get]
 Get the parameter that specifies whether this Binding allows an instance to be injected.
 
InjectionBindingType type [get, set]
 Get and set the InjectionBindingType. More...
 
new object key [get]
 
new object name [get]
 
new object value [get]
 
new Enum keyConstraint [get, set]
 
new Enum valueConstraint [get, set]
 
- Properties inherited from strange.framework.api.IBinding
object key [get]
 Get the binding''s key.
 
object name [get]
 Get the binding's name.
 
object value [get]
 Get the binding's value.
 
Enum keyConstraint [get, set]
 Get or set a MANY or ONE constraint on the Key.
 
Enum valueConstraint [get, set]
 Get or set a MANY or ONE constraint on the Value.
 
bool isWeak [get]
 

Detailed Description

The Binding form for the Injection system.

The InjectionBinding allows mapping to three core types:

Named injections are supported, thus:

Bind<IMyInterface>().To<MyInterfaceImplementer>().ToName(SomeEnum.VALUE);

returns a MyInterfaceImplementer instance only to injections that specifically tag SomeEnum.Value. This will be the same instance whenever it is called.

You can also map multiple Keys, allowing for polymorphic binding. This allows you to match two or more interfaces to a single class or value.

Bind<IFirstInterface>().Bind<ISecondInterface>().To<PolymorphicClass>();

Note that while you can bind multiple keys to an InjectionBinding, you can only bind one value. (The Injection system needs to know which concrete class you want created.)

See Also
strange.extensions.injector.api.IInjectionBinder

Property Documentation

InjectionBindingType strange.extensions.injector.api.IInjectionBinding.type
getset

Get and set the InjectionBindingType.

See Also
InjectionBindingType

The documentation for this interface was generated from the following file: