Remove deprecated registration option

This commit is contained in:
Mike Bierlee 2015-12-28 22:42:23 +01:00
parent 435dc37c3c
commit 4b1bc5077a
3 changed files with 1 additions and 35 deletions

View file

@ -5,6 +5,7 @@ Poodinis Changelog
should not be affected by this change. should not be affected by this change.
* ADD application contexts. You can register dependencies within an application context which allow you to fine-tune the creation of dependency instances. * ADD application contexts. You can register dependencies within an application context which allow you to fine-tune the creation of dependency instances.
* CHANGE all public poodinis imports to private. This should not affect you if you use the package import "poodinis" instead of individual modules. * CHANGE all public poodinis imports to private. This should not affect you if you use the package import "poodinis" instead of individual modules.
* REMOVE deprecated ADD_CONCRETE_TYPE_REGISTRATION registration option.
**Version 5.0.0** **Version 5.0.0**
* DEPRECATE ADD_CONCRETE_TYPE_REGISTRATION registration option. It basically does nothing anymore. See next point. * DEPRECATE ADD_CONCRETE_TYPE_REGISTRATION registration option. It basically does nothing anymore. See next point.

View file

@ -47,30 +47,6 @@ class RegistrationException : Exception {
* Options which influence the process of registering dependencies * Options which influence the process of registering dependencies
*/ */
public enum RegistrationOption { public enum RegistrationOption {
/**
* When registering a type by its supertype, providing this option will also register
* a linked registration to the type itself.
*
* This allows you to resolve that type both by super type and concrete type using the
* same registration scope (and instance managed by this scope).
*
* Examples:
* ---
* class Cat : Animal { ... }
*
* container.register!(Animal, Cat)(RegistrationOptions.ADD_CONCRETE_TYPE_REGISTRATION);
*
* auto firstCat = container.resolve!(Animal, Cat);
* auto secondCat = container.resolve!Cat;
*
* assert(firstCat is secondCat);
* ---
*
* Deprecated: ADD_CONCRETE_TYPE_REGISTRATION behaviour is default now. If you want to reverse to happen, use DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION.
*/
ADD_CONCRETE_TYPE_REGISTRATION,
/** /**
* Prevent a concrete type being registered on itself. With this option you will always need * Prevent a concrete type being registered on itself. With this option you will always need
* to use the supertype as the type of the dependency. * to use the supertype as the type of the dependency.

View file

@ -494,17 +494,6 @@ version(unittest) {
assert(expectedTestClass is actualTestClass, "Instance resolved in main thread is not the one resolved in thread"); assert(expectedTestClass is actualTestClass, "Instance resolved in main thread is not the one resolved in thread");
} }
// Test registering type with option ADD_CONCRETE_TYPE_REGISTRATION
unittest {
shared(DependencyContainer) container = new DependencyContainer();
container.register!(TestInterface, TestClass)(RegistrationOption.ADD_CONCRETE_TYPE_REGISTRATION);
auto firstInstance = container.resolve!TestInterface;
auto secondInstance = container.resolve!TestClass;
assert(firstInstance is secondInstance);
}
// Test registering type with option DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION // Test registering type with option DO_NOT_ADD_CONCRETE_TYPE_REGISTRATION
unittest { unittest {
shared(DependencyContainer) container = new DependencyContainer(); shared(DependencyContainer) container = new DependencyContainer();