mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Return resolved instances by qualifier type instead
This commit is contained in:
parent
7a628c32c4
commit
99579060d3
|
@ -81,7 +81,7 @@ class DependencyContainer {
|
||||||
return resolve!(RegistrationType, RegistrationType)();
|
return resolve!(RegistrationType, RegistrationType)();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RegistrationType resolve(RegistrationType, QualifierType : RegistrationType)() {
|
public QualifierType resolve(RegistrationType, QualifierType : RegistrationType)() {
|
||||||
TypeInfo resolveType = typeid(RegistrationType);
|
TypeInfo resolveType = typeid(RegistrationType);
|
||||||
TypeInfo qualifierType = typeid(QualifierType);
|
TypeInfo qualifierType = typeid(QualifierType);
|
||||||
|
|
||||||
|
@ -95,11 +95,11 @@ class DependencyContainer {
|
||||||
}
|
}
|
||||||
|
|
||||||
Registration registration = getQualifiedRegistration(resolveType, qualifierType, *candidates);
|
Registration registration = getQualifiedRegistration(resolveType, qualifierType, *candidates);
|
||||||
RegistrationType instance = cast(RegistrationType) registration.getInstance();
|
QualifierType instance = cast(QualifierType) registration.getInstance();
|
||||||
|
|
||||||
if (!autowireStack.canFind(registration)) {
|
if (!autowireStack.canFind(registration)) {
|
||||||
autowireStack ~= registration;
|
autowireStack ~= registration;
|
||||||
this.autowire!(QualifierType)(cast(QualifierType)instance);
|
this.autowire!(QualifierType)(instance);
|
||||||
autowireStack.popBack();
|
autowireStack.popBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue