Interface IUnresolvableDependencyClassifier
- Namespace
- Cratis.Arc.DependencyInjection
- Assembly
- Cratis.Arc.Core.dll
Defines a classifier that can recognize a non-nullable dependency which could not be resolved as invalid client input rather than a server-side misconfiguration.
public interface IUnresolvableDependencyClassifier
- Extension Methods
Remarks
When a non-nullable dependency resolves to null it is, by default, a misconfiguration and surfaces as a server error
(HTTP 500). Some absences are instead invalid client input — for example a Chronicle read model that does not exist
for the command's (valid) event source id. An implementation recognizes such a case and produces an exception
implementing IValidationFailure, so the pipeline surfaces it as a validation failure (HTTP 400). Implementations
are discovered through IInstancesOf<T>; a dependency that no classifier recognizes keeps
the default server-error behavior, so genuine misconfigurations are never masked as client input.
Methods
TryClassifyAsClientInput(ParameterInfo, IServiceProvider, out Exception?)
Tries to classify a non-nullable dependency that resolved to null as invalid client input.
bool TryClassifyAsClientInput(ParameterInfo parameter, IServiceProvider serviceProvider, out Exception? failure)
Parameters
parameterParameterInfoThe ParameterInfo for the dependency that could not be resolved.
serviceProviderIServiceProviderThe command-scoped IServiceProvider the dependency was resolved from.
failureExceptionThe exception describing the invalid client input, when classified; otherwise null.
Returns
- bool
True when the unresolved dependency represents invalid client input; otherwise false.