Information générale
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Tim,
I think you are focusing too much on default values. I do not believe default values are the solution here because the user could always change or delete them. At the risk of repeating myself, let me try to clarify the issue.
The problem is when you have a non-nullable numeric data type bound to a web control and the user intentionally or unintentionally removes the numeric value (leaving an empty string). Even if you had the zero default at the UI, the user may still accidently delete the zero. This could be prevented with business rules in the UI layer (i.e., client-side validation & scripting), but I'm really trying to exclusively use the business rules feature of MM (which is server-side validation) otherwise I'll have two layers of business rules and two ways of handling data validation issues.
I believe if you were using an older version of MM before the entity centric approach, since the empty value is preserved in the dataset, the null validation would work in the MM business rules. Unfortunately, in the entity centric approach, the non-nullable columns translate into non-nullable datatypes for the corresponding entity properties. There is an empty string in the dataset and a zero in the entity. That's the difference. Therefore, you can't run a null test because it is converted to a zero which could be a valid value.
Al
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement