|
总共有三类来完成验证工作,如下:
AttributeHandle.cs 类
View Code
ValidateAttribute.cs 类
View Code
ValidateType.cs 类
View Code
调用:
string checkMessage = AttributeHandle.GetValidateResult( this); if (! string.IsNullOrEmpty(checkMessage)) throw new Exception(checkMessage);
|