Specify alternative base class for strongly-typed DataSet

M

Mark Rendle

Our application, currently in .NET 1.1, uses strongly-typed DataSets as
business objects. These have been created using a third-party generator
(from AdoGuy.com) which reproduced the standard Microsoft STD code, but
added a couple of extra things to make deriving from the generated
DataSet/Table/Rows work properly. The generator was open-source, and I
modified it to allow me to specify different base classes for the
DataSet/Table/Rows, so I could add common functionality there-in.

So now we want to move the project into 2.0, and the original motive for the
alternative generator no longer exists, because STDs are declared as
partial, so business logic can be added in a separate file. But I now have a
lot of code in my alternative base classes, which would have to be
duplicated in each and every DataSet/Table/Row. We've got half a dozen
DataSets, with an average of eight tables in each, and I expect to create
another half a dozen over the next year, so that'd be a lot of work.

(Of course, when C# 3.0 appears, I could just use an extension method, but I
can't really wait another two-to-three years...)

What I'd like to do is find a way of changing the base classes in the
generated code as easily as possible. Does anyone know of a third-party
DataSet generator that will let me do this? Alternatively, how feasible
would it be to write a VS2005 plug-in to change the base classes in the
generated code, preferably automagically after the MS generator runs when
the XSD is saved, but manually if necessary? I've also considered writing a
plug-in to generate an additional partial class with the extra code in, but
that would inflate the classes quite a lot. Or are there any other
suggestions for a good way to achieve this?

Any thoughts would be much appreciated.

Oh, and Happy New Year.

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top