NHibernate.Validator vs DataAnnotations

In my APS.NET MVC project, I use DataAnnotations for validation.

I switched from L2S to NHibernate orm and actually found that NHibernate has its own validator ( NHibernate.Validator )

Does it make sense to navigate to NHibernate.Validator?

For example, DataAnnotations has the attribute [Required] and NHibernate.Validator [NotEmpty, NotNull, NotNullNotEmpty], and this makes me think what to use.

+3
source share
1 answer

I used both in production projects, and if you have time to make the switch, I would highly recommend NHibernate.Validator for two reasons:

  • NHibernate.Validators has a richer set of validation attributes (for example, a handful of you mentioned above)
  • If performed correctly, NHibernate.Validators validation is easier than unit test.

. 1 , , , , DataAnnotations (, , RegEx), . 2 , , UI/Web- WatiN Selenium. Validators ( X OR Y , ), .

Validators Validator . : http://nhibernate.info/blog/2009/04/02/nhibernate-validator-and-asp-net-mvc.html, S # arp, Billy McCafferty ASP.NET MVC DDD. , Validators Validator ModelBinder, NHibernate MVC ModelErrors. S arpArchitecture : http://github.com/codai/Sharp-Architecture.

: NHibernate.Validators , , , . DataAnnotations , .

, .

+3

Source: https://habr.com/ru/post/1753480/


All Articles