Add IfUnresolved.ReturnDefaultIfNotRegistered policy

Issue #287 resolved
Maksim Volkau
repo owner created an issue

.. in addition to current IfUnresolved.Throw and IfUnresolved.ReturnDefault.

Make it the default policy for Collection wrappers and PropertiesAndFields.Auto injection / resolution.

Comments (5)

  1. Olivier Jacot-Descombes

    Good idea! I have a case where I need to know whether the service could not be resolved because it has simply not been registered or whether a real problem occurred, like a dependency could not be resolved or because of ambiguity or whatever odd can happen. In the first case I would simply fallback to a default service but in the latter, I would like to throw an exception. I tried to use IsRegistered but this does not well. If I test for IService<Xy> but the service has been registered for IService<> (as an example), IsRegistered returns false although the service can be resolved.

  2. Log in to comment