简体   繁体   中英

Asp.Net Boilerplate throwing exception on app service validation

Fallowing the Asp.Net Boilerplate documentation, i can see that when the model is not valid an exception is thrown:

/// <summary>
/// Validates the method invocation.
/// </summary>
public void Validate()
{
    if (_parameters.IsNullOrEmpty())
    {
        //Object has no parameter, no need to validate.
        return;
    }

    if (_parameters.Length != _arguments.Length)
    {
        throw new Exception("Method parameter count does not match with argument count!");
    }

    for (var i = 0; i < _parameters.Length; i++)
    {
        Validate(_parameters[i], _arguments[i]);
    }

    if (_validationErrors.Any())
    {
        throw new AbpValidationException("Method arguments are not valid! See ValidationErrors for details.") { ValidationErrors = _validationErrors };
    }

    foreach (var argument in _arguments)
    {
        Normalize(argument); //TODO@Halil: Why not normalize recursively as we did in validation.
    }
}

Is there an alternative way in the Asp.Net Boilerplate core to change this approach?

thanl you in advance.

ABP validates input only if it implements IValidate. If you do not want to validate it, do not implement this interface, that's all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM