用户定义的验证 [英] User defined validation

查看:86
本文介绍了用户定义的验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道用户是否可以在运行时添加验证规则.我有一个可以出售给世界各地客户的系统.因此,在某些国家/地区中,某些字段是必需的,而在其他国家/地区中,则不需要.因此,我想我应该添加一些功能,以便在实现系统时可以由我设置需要验证的字段,而无需在属性中添加数据注释,然后重新编译整个系统.

I would like to kwnow if it possible for users to add validation rules at runtime. I have a system that will be sold to clients that could be anywhere in the world. So in some countries certain fields is required and in other those fields are not required. So i thought I would add functionality so that when i implement the system, the fields that needs to be validated could be set by me, without the need to add the data-annotations to the properties, then recompile the entire system.

它将是使用实体框架的ASP.NET MVC应用程序

It will be an ASP.NET MVC application using Entity Framework

致谢

推荐答案

尝试fluentvalidation http://fluentvalidation.codeplex.com

try fluentvalidation http://fluentvalidation.codeplex.com

这篇关于用户定义的验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆