Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Generated Business Rules for Numeric Columns
Message
De
09/03/2009 08:55:07
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
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:
01386595
Vues:
48
This is just starting to sink in for me so hang in there. Below in your possible soutions you mention to changing the BLG to always use nullable data types for numeric columns. My comment would be that of course Kevin will see this thread and probably make some decision or input about that, but you have you tried changing the entities in your case to be nullable types for your integers to verify that solves this problem for you? I assume then you must run some rule validation to make sure you never actually allow a null value to get saved back to the database since it isn't going to allow null values. I am curious if that alone does solve the problem for this curcumstance.
Tim

>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
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform