From 3a5d5bf214803ab7e811c9845feddf9a125db358 Mon Sep 17 00:00:00 2001 From: heromyth Date: Tue, 4 May 2021 09:45:17 +0800 Subject: [PATCH] Interface is allowed by initializedBy. --- source/poodinis/registration.d | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/poodinis/registration.d b/source/poodinis/registration.d index 58da0f3..36c8f72 100644 --- a/source/poodinis/registration.d +++ b/source/poodinis/registration.d @@ -130,7 +130,8 @@ public Registration existingInstance(Registration registration, Object instance) /** * Scopes registrations to create new instances using the given initializer delegate. */ -public Registration initializedBy(T : Object)(Registration registration, T delegate() initializer) +public Registration initializedBy(T)(Registration registration, T delegate() initializer) + if(is(T == class) || is(T == interface)) { registration.instanceFactory.factoryParameters = InstanceFactoryParameters( registration.instanceType, CreatesSingleton.no, null, {