选择验证框架 - ASP.NET
对于 Web 表单应用程序,您更喜欢哪种验证框架。这适用于相当大的复杂应用程序。我想在一个地方指定规则集和业务验证,并将其集成在客户端和服务器端。我更喜欢客户端使用 jquery。
有人有什么建议吗?
Which validation framework would you prefer for a webforms application. This would be for a rather large complex app. I would want to specify rulesets and business validation in a single place and integrate it both on the client and server side. I'd prefer jquery for client side.
Anyone has any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以查看.NET 3.5 DataAnnotations。因为它与 ASP.NET 集成得很好,但我不相信它支持规则集的概念。另一个选择是企业库验证应用程序块,它支持自定义规则集,但是,将其与 ASP.NET 集成会花费更多时间。不过,有一些在线材料可以帮助您入门。这里一篇文章(由我自己撰写)关于将 VAB 与O/RM 工具,这里是关于将 VAB 与 ASP 集成的一篇有趣的文章。网。
祝你好运。
You can look at .NET 3.5 DataAnnotations. because it integrates well with ASP.NET, but I don't believe it supports the concepts of rule sets. Another option is Enterprise Library Validation Application Block, which supports custom rule sets, however, it will take you slightly more time to integrate that with ASP.NET. However there is online material that should give you a kick start. Here an article (written by myself) about integrating VAB with O/RM tools and here is an interesting article about integrating VAB with ASP.NET.
Good luck.
对于WebForms,标准验证器提供了良好的基础,如果您使用jQuery,您可以很容易地复制asp.net验证检查并做出相应的反应,即替换并向用户提供比验证摘要控件更好的反馈。
例如,您可以使用 jquery 找到验证控件,验证并获取要验证的控件到目标,这将有助于获取错误消息、更改表单字段类等。
For WebForms, the standard validators provide a good base, if you use jQuery, you can replicate the asp.net validation checks quite easily and react accordingly, ie replace and provide better feedback to the user than the Validation Summary control.
for instance you can find the validation controls using jquery, validate and get the control-to-validate to target, this will help in getting error messages, change form field classes etc.
对于 Web 表单还是 MVC?以下是我到目前为止看到的选项:
For web forms or MVC? Here are the options I've seen so far: