public static IValidator <TRequest> FindValidatorFor <TRequest>(this ScopedServices scope) { var validatorType = typeof(IValidator <>).MakeGenericType(typeof(TRequest)); var validator = scope.Get(validatorType) as IValidator <TRequest>; if (validator == null) { throw new MiruException( $"Could not find a Validator of type {validatorType} for request of type {typeof(TRequest)}. Check if the Validators are being registered in the Container"); } return(validator); }
public IOaktonCommand CreateCommand(Type commandType) { return((IOaktonCommand)_scope.Get(commandType)); }