一个验证器可以与多个规则集关联吗?
使用 (MS) 企业库、验证应用程序块 (VAB),您可以在代码中包含属性来定义规则集。 我已将属性应用于类的属性,并且定义了两个规则集(属性属于两个验证组)。 不幸的是,两个规则集之间存在一些重叠(某些属性位于两个组中)。
验证属性可以属于多个规则集吗?语法是什么样的? 如果这不可能,有解决方法吗?
Using the (MS) Enterprise Library, Validation Application Block (VAB), you can include attributes in your code to define rule sets. I have applied the attributes to the properties of a class and I have defined two rule sets (the properties fall into two validation groups). Unfortunatly there is some overlap between the two rule sets (some properties are in both groups).
Can a validation attribute belong to multiple rule sets and what does the syntax look like? If this is not possible, is there a work-around?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
解决方法很简单,就是为每个规则集复制每个验证属性。
The work-around is simply to duplicate every validation attribute for every rule set.