Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to deal with error on update?
Message
From
17/03/2010 11:00:28
 
 
To
17/03/2010 10:40:52
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01454304
Message ID:
01455090
Views:
28
>>Getting back to what you said about "evaluating rules", isn't it the role of DAL to come across a broken rule set in the database? For example, a UNIQUE value rule that is set in the database; how would my Business layer "know" if this rule is broken until the data is sent to DB via DAL? Or am I missing something again?
>
>That can be handled in many ways also. In the app I used to work with, we had a Rules framework that all the controls worked with, so controls would turn themselves red if a rule was broken. For example, for a TextBox bound to a required field: if the user did not enter anything into that TextBox, as soon as they tabbed out of it, the TextBox automatically called the RuleChecking methods and the background would turn red. Likewise for controls that contained invalid data, according to the Rules.
>
>In the case of a UNIQUE value constraint in the database, yes you could try and save your data first and if there's an error send it all back to the UI. Or, you could let your biz class query the database for you and let you know if the value already exists, rather than wait until the save. In the case of our Rules framework (which can be considered biz classes), we'd have a UniqueRule set up for that particular field. When the user tabbed out of the TextBox, the UniqueRule would send a quick query to the backend (in this case, I think it may have done it only if the value changed ... I can't remember exactly, I'm going from memory).
>
>That help?
>
>~~Bonnie

Thank you, Bonnie. Since my current VFP application works on validation on Save record (not on each control/field) I will use the database constraint/rule as a way to validate. I know there are two schools of thought: some say it is better to let the user know right away, another is to wait until he/she decides to submit the entire change. I remember that I started my VFP app with validating each field/controls (kind of how you described) but then changed to the entire record validation. I think, in the end, as long as the data saved to the DB is validated customer should be happy.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Previous
Reply
Map
View

Click here to load this message in the networking platform