From 7b733920041a3e6ba5bbfe6c1a206268d0edce2f Mon Sep 17 00:00:00 2001 From: Mike Bierlee Date: Thu, 27 Nov 2014 00:45:26 +0100 Subject: [PATCH] Update documentation --- CHANGES.md | 3 +++ README.md | 13 +++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c690f6f..aba36eb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,8 @@ Poodinis Changelog ================== +**Version 0.2.0** +* ADD ability to register type with multiple concrete types. They can be correctly resolved using qualifiers. + **Version 0.1.4** * Make Poodinis compatible with D 2.066.0 and DUB 0.9.22 * FIX incorrect clearing of registrations diff --git a/README.md b/README.md index 8056290..e56d580 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ Poodinis Dependency Injection Framework ======================================= -Version 0.1.4 +Version 0.2.0 Copyright 2014 Mike Bierlee Licensed under the terms of the MIT license - See [LICENSE.txt](LICENSE.txt) @@ -122,6 +122,15 @@ If an interface is to be autowired, you must register a concrete class by interf ###Circular dependencies Poodinis can autowire circular dependencies when they are registered with singleInstance or existingInstance registration scopes. Circular dependencies in registrations with newInstance scopes will not be autowired, as this would cause an endless loop. +###Registering and resolving using qualifiers +You can register multiple concrete types to a super type. When doing so, you will need to specify a qualifier when resolving that type: +```d +container.register!(Color, Blue); +container.register!(Color, Red); +auto blueInstance = container.resolve!(Color, Blue); +``` +If you registered multiple concrete types to the same supertype and you do not resolve using a qualifier, a ResolveException exception is throw stating that there are multiple candidates for the type to be resolved. + Known issues ------------ * Resolving a class registered by supertype or interface will only autowire the members inherited from its supertypes and in the case of interfaces none at all. A workaround for this issue is to autowire members in the constructor of a class: @@ -147,7 +156,7 @@ Future Work ----------- * Thread safety * Component scan (auto-registration) -* Registering multiple concrete classes to the same interface +* Allow specification of qualifier when autowiring [Spring Framework]: http://projects.spring.io/spring-framework/ [Hypodermic]: https://code.google.com/p/hypodermic/