示例#1
0
 /// <summary>
 /// 创建 FormValidator 对象
 /// </summary>
 /// <param name="validators">字段验证器列表</param>
 public FormValidator( FormFieldValidatorCollection validators )
 {
   Validators = validators;
 }
示例#2
0
    /// <summary>
    /// 根据元数据获取表单验证器
    /// </summary>
    /// <returns>表单验证器</returns>
    public IFormValidator GetFormValidator()
    {

      lock ( Form.SyncRoot )
      {
        if ( formValidator == null )
        {
          var validators = new FormFieldValidatorCollection( GetFieldMetadata().Select( metadata => metadata.GetValidator() ) );
          formValidator = new FormValidator( validators );
        }
        return formValidator;
      }
    }