I've got a bunch of strongly typed DataSet that each have two tables. One table is unique for each DataSet, but the second, "MetaData", has the same schema for each DataSet.
At runtime, I determine which DataSet I want to use, and populate the data table in the appropriate way from a DB.
I then want to populate the MetaData table. This would be done in the same way for each DataSet, so I'd like to use the same code. One obvious way to do this would be to have each of the DataSets implement an interface that would do the work.
The problem comes when I want to declare this interface (IMyInterface) for these DataSets.
Each strongly typed DataSet comes in a multitude of files. The first, and critical, file is the MyDataSet.Designer.cs file…this is a file that is auto-generated. There's a line near the beginning that reads:
public partial class MyDataSet : global::System.Data.DataSet
I could add my interface after this, but I have every reason to believe that it could/would be wiped out when this file is regenerated.
If I tell VS that I want to edit the code for the DataSet, it creates a new file for me called MyDataSet.cs. But the declaration in there looks like this:
partial class MyDataSet
If I tried to add an interface to this like this:
partial class MyDataSet : IMyInterface
it would look like I was trying to add a subclass.
What's the proper way to handle this? Change the designer file, and make sure VS doesn't ever regenerate it? Add both the superclass and the interface declaration to the other file? Something else entirely?