Dofactory.com
Dofactory.com
 Back to list
Views:   5.3K
Replies:  1
Archived

Business Process - Add Validation Unique

Hello,

At the sample pattern in action. I conclude that the Business Layer has no relationship with Data Layer, but Data Layer who have a relation to Business Layer.
Then I want to ask, what if I want to add validation to a unique value in the Business Layer ?
ex :
AddRule(New ValidateUnique("Code"))

Best Regards,
Eric Santoso
Eric Santoso, Oct 19, 2015
Reply 1
Hello Eric: 

A unique value can only be detected by querying the database. This means that you will have to do some hand coding. 

In the UI you can use an Ajax call.  In the application server (i.e."code behind') you can execute a database query. Finally in the database itself you probably have a unique constraint (unique index) on the particular value you are checking.

This duplication is the nature of validation if you want the user to have a great user-experience.
Hope this helps.

Jack
Jack Poorte, Nov 04, 2015
Stay Inspired!
Join other developers and designers who have already signed up for our mailing list.
Terms     Privacy     Cookies       Do Not Sell       Licensing      
Made with    in Austin, Texas.  - vsn 44.0.0
© Data & Object Factory, LLC.