Information générale
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Al,
I have read through this thread and I am still not sure what you are trying to accomplish. If null is not allowed on the column, then just change the business rule to check for this. You can use the IsEmpty method with a second parameter for alloEmptyValues set to true which will return true only when null. See the dev guide for explanation of this method and how to use it.
As far as the user clearing out the value, just have the interface check for this and replace the value with null if you do not want the user to do this, or replace with zero if clearing out the value equates to zero.
>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