Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generated Business Rules for Numeric Columns
Message
De
06/03/2009 10:21:20
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
05/03/2009 18:12:03
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
C# 3.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01383003
Message ID:
01386171
Vues:
42
Hi Al,

The default values are set when the new entity is first created and not again after the user edits the data.
The rules on the other hand run after the save is initiated and can be customized to do whatever you want. If you want to pre-test for empty and return a broken rule you can. Also, if you want to pre-test for zero and return a broken rule you can. You could even in your UI ask the user if they intended to leave that value set to zero. If zero is acceptable but not likely then I would probably not set the default, but set my rule up to allow zero but decline an empty value. Rules are customizable method to your desire. I hope that helps.
Tim

>Kevin,
>
>That would work in some cases, but I have a requirement where zero is the least likely value so it wouldn't make sense to default it to zero. There is also the possibility of the user accidently deleting the value and then zero would inadvertently be inserted. I could probably prevent this with client-side validation, but doesn't that kind of defeat the purpose of having the business rules in the business objects?
>
>I think part of the problem is that the web controls are really text based controls (HTML) where an empty string is natively acceptable. The MM datasets retain the null value but the entities do not when the column is non-nullable.
>
>Al
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform