Broken Rules issues in 2.1Broken Rules issues in 2.1
Old forum URL: forums.lhotka.net/forums/t/1903.aspx
david.wendelken posted on Tuesday, December 05, 2006
I've run into some issues with the way rules are being handled in v2.1.
Basically, the problems I've run into all derive from a new capability that hasn't been fully rippled through the library and sample application.
We now allow an object to be saved when rules are broken (in warning or info only state).
This allows the following situations to occur:
- An editable object can have broken rules when it is loaded from the database. The sample project does not check for broken rules when the object is loaded. Adding ValidationRules.CheckRules(); after MarkOld(); appears to do the trick. Of course, if there are no rules with an Information or Warning status, that step does not need to be done.
- A read only object can also initialized from the database with broken rules, for the same reason. (Just because the user isn't allowed to change the data in that use case doesn't mean that the rules aren't broken! I may need to inform one user so they apply pressure on another user who has the authority to change the data.)
- The ReadOnlyBase class does not have support for validation rules, which makes it hard to add in support for this. (I suppose I could just use BusinessBase and disable the editing features but have never had occasion to use it.)
Comments?
xal replied on Wednesday, December 06, 2006
As far as bullet # 1, I always call CheckRules inside dataportal fetch. Why?, simply because not all the data in the tables are loaded through the BOs. There's always someone playing directly in the tables, or an import tool that does massive inserts or updates which could potentially screw up the data and fetched objects invalid.
Just my 2 cents.
Andrés
Copyright (c) Marimer LLC