Constructs a class or struct via Dependency Injection.
Limitations:
See Injector.execute.
There are no guard checks implemented to ensure services with incompatible lifetimes aren't being used together. However, ServiceProvider does contain
a check for this, please refer to its documentation.
There are no guard checks implemented to block circular references between services. However, ServiceProvider does contain
a check for this, please refer to its documentation.
Behaviour:
See Injector.execute for what values are injected into the ctor's parameters.
If the type has a normal ctor, then the result of __traits(getMember, T, "__ctor") is used as the constructor.
Types with multiple ctors are undefined behaviour.
If the type contains a static function called injectionCtor, then that function takes priority over any normal ctor
and will be used to construct the object. Types with multiple injectionCtors are undefined behaviour.
If the type does not contain any of the above ctor functions then:
* If the type is a class, new T() is used (if possible, otherwise compiler error).
Constructs a class or struct via Dependency Injection.
Limitations: See Injector.execute.
There are no guard checks implemented to ensure services with incompatible lifetimes aren't being used together. However, ServiceProvider does contain a check for this, please refer to its documentation.
There are no guard checks implemented to block circular references between services. However, ServiceProvider does contain a check for this, please refer to its documentation.
Behaviour: See Injector.execute for what values are injected into the ctor's parameters.
If the type has a normal ctor, then the result of __traits(getMember, T, "__ctor") is used as the constructor. Types with multiple ctors are undefined behaviour.
If the type contains a static function called injectionCtor, then that function takes priority over any normal ctor and will be used to construct the object. Types with multiple injectionCtors are undefined behaviour.
If the type does not contain any of the above ctor functions then:
* If the type is a class, new T() is used (if possible, otherwise compiler error).
* If the type is a struct, T.init is used.