首先看一下ReportServer的表结构,非常简单:
项目中的Model文件,除了有对应数据库表的字段的属性外,因为还实现了IDataErrorInfo接口,所以在Model中还会对属性值进行有效性验证,在最终用户界面上表现的结果是(端口号要求只能为数字):
这就是ReportServerModel实现接口IDataErrorInfo的作用了,部分代码:
#region IDataErrorInfo的成员
string IDataErrorInfo.Error // 该属性其实是不会被调用到的
{
get { return null; }
}
string IDataErrorInfo.this[string propertyName]
{
// 这里调用了自定义的GetValidationError函数,具体代码参考附件源码
get { return this.GetValidationError(propertyName); }
}
#endregion
string IDataErrorInfo.Error // 该属性其实是不会被调用到的
{
get { return null; }
}
string IDataErrorInfo.this[string propertyName]
{
// 这里调用了自定义的GetValidationError函数,具体代码参考附件源码
get { return this.GetValidationError(propertyName); }
}
#endregion