mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Allow register by concrete type to also get registration options
Although the currently only available option will do nothing
This commit is contained in:
parent
065e7111cd
commit
e7a29f17f7
|
@ -98,8 +98,8 @@ synchronized class DependencyContainer {
|
||||||
*
|
*
|
||||||
* See_Also: singleInstance, newInstance, existingInstance
|
* See_Also: singleInstance, newInstance, existingInstance
|
||||||
*/
|
*/
|
||||||
public Registration register(ConcreteType)() {
|
public Registration register(ConcreteType)(RegistrationOption[] options = []) {
|
||||||
return register!(ConcreteType, ConcreteType)([]);
|
return register!(ConcreteType, ConcreteType)(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -511,6 +511,14 @@ version(unittest) {
|
||||||
auto firstInstance = container.resolve!TestInterface;
|
auto firstInstance = container.resolve!TestInterface;
|
||||||
assertThrown!ResolveException(container.resolve!TestClass);
|
assertThrown!ResolveException(container.resolve!TestClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test registering conrete type with registration option doNotAddConcreteTypeRegistration does nothing
|
||||||
|
unittest {
|
||||||
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
container.register!TestClass([RegistrationOption.doNotAddConcreteTypeRegistration]);
|
||||||
|
container.resolve!TestClass;
|
||||||
|
}
|
||||||
|
|
||||||
// Test registering type with options in the DEPRECATED way
|
// Test registering type with options in the DEPRECATED way
|
||||||
unittest {
|
unittest {
|
||||||
shared(DependencyContainer) container = new DependencyContainer();
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
|
Loading…
Reference in a new issue