mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Add global autowire function
This commit is contained in:
parent
7dbf5ace61
commit
edb39c6d54
|
@ -133,8 +133,7 @@ class ComponentF {
|
|||
public ComponentA componentA;
|
||||
|
||||
public this() {
|
||||
auto container = Container.getInstance();
|
||||
container.autowire!(typeof(this))(this);
|
||||
globalAutowire!(typeof(this))(this);
|
||||
}
|
||||
|
||||
// or use:
|
||||
|
|
|
@ -40,7 +40,10 @@ public void autowire(Type)(Container container, Type instance) {
|
|||
|
||||
mixin template AutowireConstructor() {
|
||||
public this() {
|
||||
auto __container = Container.getInstance();
|
||||
__container.autowire!(typeof(this))(this);
|
||||
globalAutowire!(typeof(this))(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void globalAutowire(Type)(Type instance) {
|
||||
Container.getInstance().autowire!(typeof(instance))(instance);
|
||||
}
|
Loading…
Reference in a new issue