mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Fix registerOnResolve not working for classes that have no default constructor
It might be that these want to make use of constructor injection instead
This commit is contained in:
parent
f7578d79a3
commit
5a66bdc26a
|
@ -3,6 +3,7 @@ Poodinis Changelog
|
||||||
|
|
||||||
**Version NEXT**
|
**Version NEXT**
|
||||||
* FIX unnecessary re-registration of types when registerBeforeResolving is specified.
|
* FIX unnecessary re-registration of types when registerBeforeResolving is specified.
|
||||||
|
* FIX registerOnResolve not working for classes that have no default constructor
|
||||||
|
|
||||||
**Version 8.1.2**
|
**Version 8.1.2**
|
||||||
* FIX compilation error on importing template types that are not actually types.
|
* FIX compilation error on importing template types that are not actually types.
|
||||||
|
|
|
@ -184,7 +184,6 @@ synchronized class DependencyContainer
|
||||||
SuperType)(RegistrationOption options = RegistrationOption.none)
|
SuperType)(RegistrationOption options = RegistrationOption.none)
|
||||||
if (!is(ConcreteType == struct))
|
if (!is(ConcreteType == struct))
|
||||||
{
|
{
|
||||||
|
|
||||||
TypeInfo registeredType = typeid(SuperType);
|
TypeInfo registeredType = typeid(SuperType);
|
||||||
TypeInfo_Class concreteType = typeid(ConcreteType);
|
TypeInfo_Class concreteType = typeid(ConcreteType);
|
||||||
|
|
||||||
|
@ -346,10 +345,10 @@ synchronized class DependencyContainer
|
||||||
auto candidates = resolveType in registrations;
|
auto candidates = resolveType in registrations;
|
||||||
if (!candidates)
|
if (!candidates)
|
||||||
{
|
{
|
||||||
if (hasOption(resolveOptions, persistentResolveOptions,
|
static if (is(typeof(typeid(QualifierType)) == TypeInfo_Class) && !__traits(isAbstractClass, QualifierType))
|
||||||
ResolveOption.registerBeforeResolving))
|
|
||||||
{
|
{
|
||||||
static if (__traits(compiles, new QualifierType()))
|
if (hasOption(resolveOptions, persistentResolveOptions, ResolveOption
|
||||||
|
.registerBeforeResolving))
|
||||||
{
|
{
|
||||||
register!(RegistrationType, QualifierType)();
|
register!(RegistrationType, QualifierType)();
|
||||||
return resolve!(RegistrationType, QualifierType)(resolveOptions);
|
return resolve!(RegistrationType, QualifierType)(resolveOptions);
|
||||||
|
|
Loading…
Reference in a new issue