/// <summary> /// 创建 FormValidator 对象 /// </summary> /// <param name="validators">字段验证器列表</param> public FormValidator( FormFieldValidatorCollection validators ) { Validators = validators; }
/// <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; } }