Class design when working with dataset
- by MC
If you have to retrieve data from a database and bring this dataset to the client, and then allow the user to manipulate the data in various ways before updating the database again, what is a good class design for this if the data tables will not have a 1:1 relationship with the class objects?
Here are some I came up with:
Just manipulate the DataSet itself on the client and then send it back to the database as is. This will work though obviously the code will be very dirty and not well-structured.
Same as #1, but wrap the dataset code around classes. What I mean is that you may have a class that takes a dataset or a datatable in its constructor, and then provides public methods and properties to simplify the code. Inside these methods and properties it will be reading or manipulating the dataset. To update the database afterwards will be easy because you already have the updated dataset.
Get rid of the dataset entirely on the client, convert to objects, then convert back to a dataset when needing to update the database.
Is there any good resources where I can find information on this?