/// <summary>
 /// 拓展方法,验证类类型对象
 /// </summary>
 /// <param name="obj">对象实例</param>
 /// <param name="validateAllProperties">是否验证所有属性</param>
 /// <returns>验证结果</returns>
 public static DataValidationResult TryValidate(this object obj, bool validateAllProperties = true)
 {
     return(DataValidator.TryValidateObject(obj, validateAllProperties));
 }
 /// <summary>
 /// 拓展方法,验证类类型对象
 /// </summary>
 /// <param name="obj">对象实例</param>
 /// <param name="validateAllProperties">是否验证所有属性</param>
 public static void Validate(this object obj, bool validateAllProperties = true)
 {
     DataValidator.TryValidateObject(obj, validateAllProperties).AddError();
 }