Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / December 2006

Tip: Looking for answers? Try searching our database.

generate TypedDataSet with custom DataTable via designer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
orenl - 24 Dec 2006 14:07 GMT
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?
RobinS - 24 Dec 2006 18:58 GMT
I don't think you can. You might be able to cast it to your
datatable when you instantiate it, though.

Also, you should *not* manually edit the generated code; it will be
recreated when/if you re-create the dataset, and wipe out any
changes you have made to it.

Robin S.
-----------------------------
> Hi,
> Im using the VisualStudio 2005 designer to create typedDataSet (drag &
[quoted text clipped - 3 lines]
> MyDataTable (a custom DataTable) instead.
> How can I do that without manually editing the generated code?
orenl - 25 Dec 2006 10:55 GMT
I know I shouldn't manually edit generated code thats why Im looking
for automatically inherit from MyDataSet.

there must be a way to changing cause I want to optionally implement
specified methods (and do not want the implementation to be mandatory
by using interfaces)
RobinS - 26 Dec 2006 22:27 GMT
The only thing I can think of is that you can access a strongly
typed dataset as an untyped one. So you could convert the
strongly-typed datatable to your derived datatable in order to
use whatever methods you want to use. You can then convert it
back to the strongly-typed dataset *IF* you haven't changed
its structure.

You can NOT convert any old untyped dataset to a strongly typed one
-- you can only convert one that was originally instantiated as the
strongly typed dataset.

'This is VB2005.
Dim dsStronglyTyped As New NorthwindDataSet()
Dim dsUntyped As DataSet
dsUnTyped = CType(dsStronglyTyped, DataSet)
'do some stuff to the data in the dataset, then convert it back
dsStronglyTyped2 = CType(dsUntyped, NorthwindDataSet)

Of course, you lose the features of the strongly typed dataset
when dealing with the untyped one.

Good luck.
Robin S.
----------------------------------------

>I know I shouldn't manually edit generated code thats why Im looking
> for automatically inherit from MyDataSet.
>
> there must be a way to changing cause I want to optionally implement
> specified methods (and do not want the implementation to be mandatory
> by using interfaces)
orenl - 28 Dec 2006 12:01 GMT
but my problem is that I don't want to loose the benefits of strongly
typed DataSet.

there must be a way to extend the VisualStudio2005 typedDataSet
designer.
the current designer is MSDataSetGenerator and I don't know how to see
its code.
RobinS - 28 Dec 2006 17:49 GMT
You could try generating your own typedDataSet.

You create your dataset in code using FillSchema,
then do a dataset.WriteXmlSchema to create an XSD file.
Then you use the XML Schema Definition Tool to generate
a class file based on the XML schema.  Then you can
add the class to your project.

I can post the code if you want me to, but I'm not sure it
is going to get you anywhere. It's pretty much the same as
doing it in Visual Studio.

Other than that, I don't know of a way to do what you're
trying to do. You could try posting to
microsoft.public.dotnet.framework.adonet
and see if Bill Vaughn can help you.

Robin S.
--------------------------------------

> but my problem is that I don't want to loose the benefits of strongly
> typed DataSet.
[quoted text clipped - 3 lines]
> the current designer is MSDataSetGenerator and I don't know how to see
> its code.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.