NHibernate Validator和ASP.NET MVC 4

时间:2022-01-24 03:10:32

We're looking at upgrading a large-scale project currently implemented using ASP.NET MVC 2 with xVal providing the glue between NHibernate Validator and client-side validation.

我们正在考虑升级当前使用ASP.NET MVC 2实现的大型项目,使用xVal提供NHibernate Validator和客户端验证之间的粘合剂。

When I was looking for resources on using the new "unobtrusive" client side validation used in MVC 3/4 with NHibernate Validator, I was only able to locate a single (and nearly 3 year-old) blog post about this.

当我在寻找资源使用MVC 3/4和NHibernate Validator中使用的新的“不引人注目的”客户端验证时,我只能找到一篇关于此的博客文章(和近3年之久)。

Has anyone successfully used NHibernate Validator for client-side validation in MVC 3/4? If so, what has your experience been?

有没有人在MVC 3/4中成功使用NHibernate Validator进行客户端验证?如果是这样,你的经历是什么?

2 个解决方案

#1


2  

Although I don't have any experience directly with NHibernate, FluentValidation (a validation framework worth considering itself) has an MVC 3/4 adapter extension project which would serve as an excellent guide to creating an NHibernate Validator implementation.

虽然我没有直接使用NHibernate的经验,但FluentValidation(一个值得考虑自己的验证框架)有一个MVC 3/4适配器扩展项目,它可以作为创建NHibernate Validator实现的出色指南。

#2


0  

So, i've never used NHibernate Validator, but consider to, because NHibernate Validator has a better perfomance than native MVC unobtrusive validator(MVC validator is totaly based on reflection, in case of NHibernate Validator reflection work happens at startup only). In case of a large-scale project, i think it is better way.

所以,我从来没有使用NHibernate Validator,但考虑到,因为NHibernate Validator比原生MVC不显眼的验证器具有更好的性能(MVC验证器完全基于反射,如果NHibernate Validator反射工作仅在启动时发生)。在大型项目的情况下,我认为这是更好的方式。

#1


2  

Although I don't have any experience directly with NHibernate, FluentValidation (a validation framework worth considering itself) has an MVC 3/4 adapter extension project which would serve as an excellent guide to creating an NHibernate Validator implementation.

虽然我没有直接使用NHibernate的经验,但FluentValidation(一个值得考虑自己的验证框架)有一个MVC 3/4适配器扩展项目,它可以作为创建NHibernate Validator实现的出色指南。

#2


0  

So, i've never used NHibernate Validator, but consider to, because NHibernate Validator has a better perfomance than native MVC unobtrusive validator(MVC validator is totaly based on reflection, in case of NHibernate Validator reflection work happens at startup only). In case of a large-scale project, i think it is better way.

所以,我从来没有使用NHibernate Validator,但考虑到,因为NHibernate Validator比原生MVC不显眼的验证器具有更好的性能(MVC验证器完全基于反射,如果NHibernate Validator反射工作仅在启动时发生)。在大型项目的情况下,我认为这是更好的方式。