Hi,
Im using the VisualStudio 2005 designer to create typedDataSet (drag &
drop from the service explorer).
All the DataTables in the generated code inherit from
System.Data.DataTable, I would like the dataTables to inherit from
MyDataTable (a custom DataTable) instead.
How can I do that without manually editing the generated code?

Re: DataTable/DataSet extention by Petar

Petar
Tue Jan 23 14:01:22 CST 2007

orenl wrote:
> Hi,
> Im using the VisualStudio 2005 designer to create typedDataSet (drag &
> drop from the service explorer).
> All the DataTables in the generated code inherit from
> System.Data.DataTable, I would like the dataTables to inherit from
> MyDataTable (a custom DataTable) instead.
> How can I do that without manually editing the generated code?
>

Hi orenl !

This would be difficult I think. No easy way to do that.
Maybe some macro could automate the thing but I would consider that a
dirty trick (prone to error if you forget to run the macro).
You could write a custom tool that get .xsd and create your custom
dataset with MyDataTables in it. No easy task.

But, I think the question here is why you need tables to inherit from
MyDataTable ?

Petar Repac

Re: DataTable/DataSet extention by orenl

orenl
Wed Jan 24 01:58:44 CST 2007

I need inheritance to apply some behaivior on the data tables.
for example :


Re: DataTable/DataSet extention by orenl

orenl
Wed Jan 24 01:59:24 CST 2007

I need

for example :


Re: DataTable/DataSet extention by orenl

orenl
Wed Jan 24 02:05:49 CST 2007

for example every DataTable inherits from MyDataTable :
will have a primaryKey named Id.
may implement a service that apply persistance
(where unlike interface, with a abstract DataTable I can create a
default behavior which is generally sufficient).

Im building a new framework based on DataSet and there are many more
features that come up on the way and I can only apply them by an
abstract DataSet.
keep in mind that I do not want to give up the use in the VS designer
so Iam in a bit of a problem.


Re: DataTable/DataSet extention by Petar

Petar
Wed Jan 24 02:08:28 CST 2007

orenl wrote:
> I need inheritance to apply some behaivior on the data tables.
> for example :
>

Your example is missing.

Re: DataTable/DataSet extention by Petar

Petar
Wed Jan 24 02:11:22 CST 2007

orenl wrote:
> I need inheritance to apply some behaivior on the data tables.
> for example :
>

Sorry but can't see your example

Re: DataTable/DataSet extention by Petar

Petar
Wed Jan 24 03:15:58 CST 2007

orenl wrote:
> for example every DataTable inherits from MyDataTable :
> will have a primaryKey named Id.
> may implement a service that apply persistance
> (where unlike interface, with a abstract DataTable I can create a
> default behavior which is generally sufficient).
>
> Im building a new framework based on DataSet and there are many more
> features that come up on the way and I can only apply them by an
> abstract DataSet.
> keep in mind that I do not want to give up the use in the VS designer
> so Iam in a bit of a problem.
>

1) I have developed a framework based on DataSets and should warn you
that this maybe is not such a good idea. For example say you want to
publish your business entity (dataset) on web service. Nobody except
.NET app could use it. For example look at:
http://www.hanselman.com/blog/ReturningDataSetsFromWebServicesIsTheSpawnOfSatanAndRepresentsAllThatIsTrulyEvilInTheWorld.aspx

2) Maybe you should consider a situation when you must develop an app
that works on some existing database and you find that in that database
you have a table that has an primary key that is of string type.

3) DataSet is meant to be an data structure that is not aware of source
of data. You could get data in dataset from XML, database, flat file,
... So persistance service should not be implemented in MyDataTable.

Regards
Petar Repac