MVC2 DataAnnotations with Server Side Validation

How do you test an object containing DataAnnotations without using the MVC library? Using Model.IsValid is great when you are at the presentation level, but what about when you want the model to be valid at the Domain / Business level? Do I need a separate verification system, or is there a simple way that I am missing?

Thanks for any help

Mark

+3
source share
2 answers

, ModelState.IsValid Model.IsValid, ? , DataAnnotions MVC, IValidatableObject.

, , Validator class , Validator.ValidateObject(, ValidationContext).

+1

, #, - , try catch -. , . , . [] ajax , , - , , , .

-1

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


All Articles