总共有三类来完成验证工作,如下:
AttributeHandle.cs 类
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
ValidateAttribute.cs 类
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
ValidateType.cs 类
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
调用:
string checkMessage = AttributeHandle.GetValidateResult(this);
if (!string.IsNullOrEmpty(checkMessage))
throw new Exception(checkMessage);
if (!string.IsNullOrEmpty(checkMessage))
throw new Exception(checkMessage);