Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generated Business Rules for Numeric Columns
Message
De
06/03/2009 19:02:54
 
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:
01386340
Vues:
48
I appreciate your patience with me. Let me try again.

It is impossible for the AllowEmptyValues parameter to work properly because when using the entity centric approach the generated business rules use the entity and the data type will always be not nullable when the database column is not nullable. That means the entity which is used in the business rules will never have a null value in it even if the UI control does have a null value.

Maybe this chart willl help clarify things:

Column
Nullable UI Dataset Entity
Yes null null null
No null null 0
Yes 0 0 0
No 0 0 0

Note the anomaly in the second case where it is a nullable column with null in the UI. This results in a null in the recordset and a zero in the entity. That makes it impossible for the AllowEmptyValues parameter to work properly. It doesn't know about the null.

I see two possible solutions to this problem. The first choice is to change the BLG to always use nullable data types for numeric columns. This will create nullable data types in the entities and then the generated business rules will work properly in this case.

The second option is to manage this in the UI. I'm not too excited about that because when you start getting into the complexities with grids and their edit modes, it can be a lot of extra work. It also defeats the purpose of putting all your business rules in the business layer.

Al
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform