R – Tips for using Visual Studio Typed DataSets


When using strongly typed dataSets in Visual Studio 2005/2008, if the underlying database schema changes, the only practical way to refresh is to delete the dataset and recreate it from scratch. This is OK unless I need to customize the dataset.

Customizing by extending the partial dataset class allows customizations to be retained, but then a simple FillBy() again becomes a long sequence of SQL.

Is there any way to resynchronize a dataset with the database schema without losing dataset customizations?

Best Solution

Because typed datasets use generated nested classes, customizations will often be lost. What I do is generate the typed dataset, and then mark several classes as partial. Then I create separate files containing a duplicate nested class structure (also marked partial).

This way I can regenerate my data set and the only update I have to do is to go back and make them partial again. My customizations are kept in separate files.