Will validators duplicate business logic?

I know that you can use validators to check data input at the presentation level of the application (for example, regular expression, required fields, etc.), and also to display a message and / or the desired marker icon. Data validation usually belongs to the business layer. How do I avoid supporting two sets of validations for the data that I collect?

EDIT: I know that ad validation is good and that it informs the user and that it is not infallible. The fact remains, is it not that I am testing the same thing in two places?

+3
source share
4 answers

Yes and no.

. , n-, .

, - . , Active Directory . , , , -, .

- . -. , , . - . , . , , , , . , , . , .

, , DRY ( ) , . . ( , .)

+4

, ( ) , ; , , (-). , , , DRY.

EDIT: , , . - , . , , , ( ), , , .

+3

, . 1. 2. , .

UI , .

0

. . - -.

UI RequiredFieldValidators , ASP.NET. , . , .

, , :

http://highoncoding.com/Articles/424_Creating_a_Domain_Object_Validation_Framework.aspx

0

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


All Articles