mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Remove deprecated registration option
This commit is contained in:
parent
435dc37c3c
commit
4b1bc5077a
|
@ -5,6 +5,7 @@ Poodinis Changelog
|
|||
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.
|
||||
* 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**
|
||||
* DEPRECATE ADD_CONCRETE_TYPE_REGISTRATION registration option. It basically does nothing anymore. See next point.
|
||||
|
|
|
@ -47,30 +47,6 @@ class RegistrationException : Exception {
|
|||
* Options which influence the process of registering dependencies
|
||||
*/
|
||||
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
|
||||
* to use the supertype as the type of the dependency.
|
||||
|
|
|
@ -494,17 +494,6 @@ version(unittest) {
|
|||
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
|
||||
unittest {
|
||||
shared(DependencyContainer) container = new DependencyContainer();
|
||||
|
|
Loading…
Reference in a new issue