J'ai un exemple d'application à Nancy et j'ai un problème avec la validation de la demande. J'utilise FluentValidator avec l'extension BindAndValidate. Ainsi, par exemple, j'ai modèle:Nancy et demande de validation
public class User
{
public string Name { get; set; }
public int Age { get; set; }
}
Et module avec:
Post["/create-user"] = m => this.BindAndValidate<User>());
Et il y a problème, si l'application client module d'appel avec des paramètres Nom: "foo, Âge:" une chaîne », alors exception throw Nancy:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Exception: some-string is not a valid value for Int32. ---> System.FormatException: Input string was not in a correct format.
voici une solution de contournement pour exception par le paramètre ("âge de la propriété était pas correct tapis ")?
Merci
On dirait qu'aujourd'hui c'est bien documenté ici https://github.com/NancyFx/Nancy/wiki/Nancy-and-Validation –