mirror of
https://github.com/mbierlee/poodinis.git
synced 2024-11-15 04:04:01 +01:00
Deprecate array-based assignment of persistent resolve/registration options
This commit is contained in:
parent
f67e67b93c
commit
771c49d86a
|
@ -447,12 +447,16 @@ synchronized class DependencyContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply persistent registration options which will be used everytime register() is called.
|
* Apply persistent registration options which will be used everytime register() is called.
|
||||||
|
*
|
||||||
|
* Deprecated: use setPersistentRegistrationOptions(RegistrationOption options) instead.
|
||||||
*/
|
*/
|
||||||
public void setPersistentRegistrationOptions(RegistrationOption[] registrationOptions...) {
|
deprecated public void setPersistentRegistrationOptions(RegistrationOption[] registrationOptions...) {
|
||||||
persistentRegistrationOptions = buildFlags(registrationOptions);
|
persistentRegistrationOptions = buildFlags(registrationOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/**
|
||||||
|
* Apply persistent registration options which will be used everytime register() is called.
|
||||||
|
*/
|
||||||
public void setPersistentRegistrationOptions(RegistrationOption options) {
|
public void setPersistentRegistrationOptions(RegistrationOption options) {
|
||||||
persistentRegistrationOptions = options;
|
persistentRegistrationOptions = options;
|
||||||
}
|
}
|
||||||
|
@ -466,12 +470,15 @@ synchronized class DependencyContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply persistent resolve options which will be used everytime resolve() is called.
|
* Apply persistent resolve options which will be used everytime resolve() is called.
|
||||||
|
* Deprecated: use setPersistentResolveOptions(ResolveOption options) instead.
|
||||||
*/
|
*/
|
||||||
public void setPersistentResolveOptions(ResolveOption[] resolveOptions...) {
|
deprecated public void setPersistentResolveOptions(ResolveOption[] resolveOptions...) {
|
||||||
persistentResolveOptions = buildFlags(resolveOptions);
|
persistentResolveOptions = buildFlags(resolveOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// ditto
|
/**
|
||||||
|
* Apply persistent resolve options which will be used everytime resolve() is called.
|
||||||
|
*/
|
||||||
public void setPersistentResolveOptions(ResolveOption options) {
|
public void setPersistentResolveOptions(ResolveOption options) {
|
||||||
persistentResolveOptions = options;
|
persistentResolveOptions = options;
|
||||||
}
|
}
|
||||||
|
|
|
@ -628,6 +628,14 @@ version(unittest) {
|
||||||
assertThrown!ResolveException(container.resolve!TestClass);
|
assertThrown!ResolveException(container.resolve!TestClass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test set persistent registration options by variadic (DEPRECATED)
|
||||||
|
unittest {
|
||||||
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
container.setPersistentRegistrationOptions(RegistrationOption.none, RegistrationOption.doNotAddConcreteTypeRegistration);
|
||||||
|
container.register!(TestInterface, TestClass);
|
||||||
|
assertThrown!ResolveException(container.resolve!TestClass);
|
||||||
|
}
|
||||||
|
|
||||||
// Test unset persistent registration options
|
// Test unset persistent registration options
|
||||||
unittest {
|
unittest {
|
||||||
shared(DependencyContainer) container = new DependencyContainer();
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
@ -651,6 +659,13 @@ version(unittest) {
|
||||||
container.resolve!TestClass;
|
container.resolve!TestClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test set persistent resolve options by variadic (DEPRECATED)
|
||||||
|
unittest {
|
||||||
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
container.setPersistentResolveOptions(ResolveOption.none, ResolveOption.registerBeforeResolving);
|
||||||
|
container.resolve!TestClass;
|
||||||
|
}
|
||||||
|
|
||||||
// Test unset persistent resolve options
|
// Test unset persistent resolve options
|
||||||
unittest {
|
unittest {
|
||||||
shared(DependencyContainer) container = new DependencyContainer();
|
shared(DependencyContainer) container = new DependencyContainer();
|
||||||
|
|
Loading…
Reference in a new issue