Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Validate A Class
Message
From
05/04/2010 16:59:12
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01458686
Message ID:
01458826
Views:
42
Kevin,

>I'm not sure I'm in agreement with you and Bonnie as to where to put the validation code, and here's why. What if you get all the validation code complete and your boss decided to rebuild the app from WinForms to ASP.Net? Now you have you move all the validation code.

In my example, the validation is NOT in the UI ... the UI simply has a way of indicating that there's a problem by changing the color of the invalid control. It would be done differently in ASP.NET (indicating where the problem is), but it would still be finding the problem by calling CheckRules methods in the Rules classes.

All the checking for this invalid stuff is done in the Rules classes, which are NOT visual. Re-read what I wrote.

~~Bonnie




>I'm not sure I'm in agreement with you and Bonnie as to where to put the validation code, and here's why. What if you get all the validation code complete and your boss decided to rebuild the app from WinForms to ASP.Net? Now you have you move all the validation code.
>
>My question was more to the issue of how to deal with a property that isn't set or is incorrect? Do you throw an exception, or maybe
>set some property that tells what the issue is? Then, any other class or UI that's using is can check it.
>
>If you create a cusom exception for each required property, then throw the error, your UI's error handling scheme would catch it.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Reply
Map
View

Click here to load this message in the networking platform