微软企业库验证
来源:互联网 发布:mac office2016 破解版 编辑:程序博客网 时间:2024/05/22 23:38
http://www.cnblogs.com/kyo-yo/archive/2010/07/21/Learning-EntLib-Fifth-Introduction-Validation-module-information-Part2.html
PropertyComparisonValidator
[PropertyComparisonValidator("ComparePropB", ComparisonOperator.Equal)]
publicstringComparePropA { get; set; }
publicstringComparePropB { get; set; }
这段代码的意思是,验证属性ComparePropA是否等于ComparePropB。
这个验证器的构造函数有2个,接收3类参数:
1)字符串propertyToCompare,表示要比较的属性名
2)枚举ComparisonOperator,比较类型枚举,具体有:Equal(等于)、NotEqual(不等于)、GreaterThan(大于)、GreaterThanEqual(大于等于)、LessThan(小于)、LessThanEqual(小于等于)
3)命名参数
HasSelfValidation
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
[HasSelfValidation]
public class TemperatureRange
{
private int min;
private int max;
// ...
[SelfValidation]
public void CheckTemperature(ValidationResults results)
{
if (max < min)
results.AddResult(new ValidationResult("Max less than min", this, "", "", null));
}
}
- 微软企业库验证
- 微软企业库
- 微软企业库
- 新任务:微软的企业库.
- 新任务:微软的企业库.
- 微软企业库 简介
- 微软企业库 Enterprise Library
- 微软企业库中的事务处理
- 微软企业库 学习
- 微软企业库5.0
- 微软企业库缓存使用
- 微软企业库缓存
- 微软企业库简单用法
- 微软企业库dll引用
- 微软企业库-数据访问
- 微软企业库的使用
- 微软企业库学习笔记(一)
- 微软企业库系列讲座地址
- UIlabel添加背景图片
- 调用Form
- 程序调试中使用宏说明(Debug Routines)
- Struts2环境搭建
- 标准格式输出
- 微软企业库验证
- 目录使用说明(Directory Control)
- I2C总线被拉低引起的问题
- 关于Freebsd不能前置音频口
- ArcGIS_9.3_Javascript_API
- 异常处理说明(Exception Handling Routines)
- C#VS2008中DateTimePicker控件学习心得
- EXP用法,导出不包含同义词
- 如何设置ofbiz的日志输出级别