Just like everyone else I usually use datasets for database reads only. When updating, I simply write the changes directly to the database using SqlCommands. In my latest app I went in search of trouble and decided use .Update(DataSet) for writes. There were several implementation details which were semi-ugly, but the main thing that currently has me stumped is related to referential integrity:
If I have 2 tables, lets say Orders and OrderRows and the following code:
The code will work for inserts but not for deletes, since deletes must be done in the reverse order:
So basically I can’t just modify the dataset in the biz layer and send it to a generic “update” method in the data layer which persists the changes to the database – I actually need to know much than I want in inside the data later to in order to make this work.
Is there something simple which I am missing (code samples anyone?) or is really as limited as it seems?
P.S. I guess my mom knew what she was talking about when she said that Metallica is torture – US military interogating Iraqi POWs with Sesame Street & Metallica 🙂
<edited to remove any political overtones>