From 1869ec2782f8a739343e3018a749a38bfdd22e94 Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Tue, 23 Aug 2016 21:32:19 +0200 Subject: [PATCH] Rewrite sentence to be less confusing --- TUTORIAL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TUTORIAL.md b/TUTORIAL.md index cd91389..28bd741 100644 --- a/TUTORIAL.md +++ b/TUTORIAL.md @@ -93,7 +93,7 @@ dependencies.register!ExampleClassB; auto instance = dependencies.resolve!ExampleClassB; assert(instance.dependency !is null); ``` -If an interface is to be autowired, you must register a concrete class by interface. Any class registered by concrete type can only be injected when a dependency on a concrete type is autowired. +If an interface is to be autowired, you must register a concrete class by interface. A class registered only by concrete type can only be injected into members of that type, not its supertypes. Using the UDA `OptionalDependency` you can mark an autowired member as being optional. When a member is optional, no ResolveException will be thrown when the type of the member is not registered and `ResolveOption.registerBeforeResolving` is not set on the container. The member will remain null or an empty array in