DataTable/DataSet extention

O

orenl

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?
 
P

Petar Repac

orenl said:
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
 
O

orenl

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.
 
P

Petar Repac

orenl said:
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/Retur...ndRepresentsAllThatIsTrulyEvilInTheWorld.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
 

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