示例#1
0
 public ValidationError(string message, object value, TargetMemberMetadata targetMemberMetadata, string cause = null)
 {
     Message = message;
     Value = value;
     TargetMemberMetadata = targetMemberMetadata;
     Cause = cause ?? string.Empty;
 }
 private void ValidateAddress()
 {
     if(_address != null && _address.Country.EqualsIgnoreCase("US"))
     {
         var targetMemberMetadata = new TargetMemberMetadata(typeof(Address), typeof(Address).GetProperty("Country"), "Address.Country");
         _errors.Add(new ValidationError("This is not a valid US Address.", _address, targetMemberMetadata, cause: "{ The address was null or the country was not US. }"));
     }
 }