Exemplo n.º 1
0
 private static FSharpChoice <string, Errors> Mandatory(string s)
 {
     return(FSharpChoice.Validator <string>(x => !string.IsNullOrEmpty(x), "Mandatory field")(s));
     //if (string.IsNullOrEmpty(s))
     //    return FSharpChoice.Error<string>("Mandatory field");
     //return FSharpChoice.Ok(s);
 }
Exemplo n.º 2
0
 static FSharpChoice <T, Errors> NotEqual <T>(T value, T other, string err)
 {
     return(FSharpChoice.Validator <T>(v => !Equals(v, other), err)(value));
 }
Exemplo n.º 3
0
 static FSharpChoice <T, Errors> NonNull <T>(T value, string err) where T : class
 {
     return(FSharpChoice.Validator <T>(x => x != null, err)(value));
 }