From 0c8c1434f7f55501c5bc68aac56e5938d7760242 Mon Sep 17 00:00:00 2001 From: heromyth Date: Wed, 11 Mar 2020 09:55:15 +0800 Subject: [PATCH] Check if a Type is registered --- source/poodinis/container.d | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/poodinis/container.d b/source/poodinis/container.d index 47e8c95..ae9c36b 100644 --- a/source/poodinis/container.d +++ b/source/poodinis/container.d @@ -373,6 +373,12 @@ synchronized class DependencyContainer { } } + bool isRegistered(RegistrationType)() { + TypeInfo typeInfo = typeid(RegistrationType); + auto candidates = typeInfo in registrations; + return candidates !is null; + } + private QualifierType resolveAutowiredInstance(QualifierType)(Registration registration) { QualifierType instance; if (!(cast(Registration[]) autowireStack).canFind(registration)) {