Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Rich,
>> it would make more sense to the user (and to me now that Bob mentioned it) to force saving any
parent before adding any children for it.<<
This was my first guess, but I think you run into problems.
First, if the user wants to revert a new record, you have to convert that to a delete in code. Not the worst thing in the world, but worse...
....is the possibility of saving invalid records, records that break business rules. Let's say you don't want a Sales Order saved without a sale amount. Well, you can't have a sales amount until you enter a line item.
You might then say, well, OK, I'll put some switches in there to bypass validation when line items are being added, but enforce it when the user himself excplicitly attempts to save the header. I had no choice but to do this with a commercial framework I use, but I hate the fact that invalid headers are in the base table. Power outages, etc., can lead to bad data in the tables.
It seems to me that if you accept the must-save-parent philosophy, you have to translate all business rules so that they don't conflict with this technical requirement.
>> (That includes saving 'children' before adding 'grandchildren'.) <<
It actually generalizes more than that. Given any n-level heirarchy where n is 4 or greater, the problem repeats itself for each 3-level subset of the heirarchy.
>> Interesting discussion, again, I'm glad we're having it.
I'm very glad we're having it <s>, I'm learning a lot.
Précédent
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