Strongly typed DataSet with xsd.exe

F

Frédéric Goulet

I generate an XML file with the WriteXmlShema method of the DataSet object.

Then, I use xsd.exe to make it a strongly typed DataSet, witch generate a
Visual basic code file, MyDataSet.vb.
xsd.exe /d /l:VB "MyDataSet.xsd"

When I add both files, MyDataSet.xsd and MyDataSet.vb, to my Visual Studio
project, MyDataSet.vb does not appears as a child node of MyDataSet.xsd like
when you create a strongly typed Dataset by dropping a table on the DataSet
designer.

Is there a way to tell VSNet that MyDataSet.vb is to be linked with
MyDataSet.xsd?

Thanks a lot

Frederic Goulet
 
S

Scott Allen

Hi Frederic:

I never found a way to do this in the GUI, but if you examine the
..vbproj file for a project with a typed DataSet you'll find something
similar to the following:

<File
RelPath = "Module1.vb"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "foo.xsd"
BuildAction = "Content"
Generator = "MSDataSetGenerator"
LastGenOutput = "foo.vb"
/>
<File
RelPath = "foo.vb"
DependentUpon = "foo.xsd"
SubType = "code"
BuildAction = "Compile"
DesignTime = "True"
AutoGen = "True"
/>

So perhaps you could hand tweak the vbproj file.

HTH,
 
M

Miha Markic [MVP C#]

Hi,

You are missing the point of strong typed datasets I think.
The idea is, to create (somehow, with IDE wizard perhaps) a xsd file and
then set its CustomTool property to MSDataSetGenerator (this is done
automatically within VS.NET when you create new strong typed dataset) -which
will take care of transforming xsd into vb or whatever other language.

So, in you example you have two options:
a) don't include xsd file since your vb code is already there
b) don't include vb code and set CustomTool to MSDataSetGenerator)

It is either one or the another.
 
S

Scott Allen

Good point, Miha.

--s

Hi,

You are missing the point of strong typed datasets I think.
The idea is, to create (somehow, with IDE wizard perhaps) a xsd file and
then set its CustomTool property to MSDataSetGenerator (this is done
automatically within VS.NET when you create new strong typed dataset) -which
will take care of transforming xsd into vb or whatever other language.

So, in you example you have two options:
a) don't include xsd file since your vb code is already there
b) don't include vb code and set CustomTool to MSDataSetGenerator)

It is either one or the another.
 
F

Frédéric Goulet

Hi Miha,
Thanks for pointing me on the MSDataSetGenerator custom tools. It do exactly
what I needed.

Frederic



Miha Markic said:
Hi,

You are missing the point of strong typed datasets I think.
The idea is, to create (somehow, with IDE wizard perhaps) a xsd file and
then set its CustomTool property to MSDataSetGenerator (this is done
automatically within VS.NET when you create new strong typed dataset) -which
will take care of transforming xsd into vb or whatever other language.

So, in you example you have two options:
a) don't include xsd file since your vb code is already there
b) don't include vb code and set CustomTool to MSDataSetGenerator)

It is either one or the another.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com


Frédéric Goulet said:
I generate an XML file with the WriteXmlShema method of the DataSet object.

Then, I use xsd.exe to make it a strongly typed DataSet, witch generate a
Visual basic code file, MyDataSet.vb.
xsd.exe /d /l:VB "MyDataSet.xsd"

When I add both files, MyDataSet.xsd and MyDataSet.vb, to my Visual Studio
project, MyDataSet.vb does not appears as a child node of MyDataSet.xsd like
when you create a strongly typed Dataset by dropping a table on the DataSet
designer.

Is there a way to tell VSNet that MyDataSet.vb is to be linked with
MyDataSet.xsd?

Thanks a lot

Frederic Goulet
 
M

Miha Markic [MVP C#]

Hi guys,

Visit my website www.rthand.com (.net utilities) to see another approach
(using CodeSmith) - check out templates.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

Frédéric Goulet said:
Hi Miha,
Thanks for pointing me on the MSDataSetGenerator custom tools. It do exactly
what I needed.

Frederic



Miha Markic said:
Hi,

You are missing the point of strong typed datasets I think.
The idea is, to create (somehow, with IDE wizard perhaps) a xsd file and
then set its CustomTool property to MSDataSetGenerator (this is done
automatically within VS.NET when you create new strong typed dataset) -which
will take care of transforming xsd into vb or whatever other language.

So, in you example you have two options:
a) don't include xsd file since your vb code is already there
b) don't include vb code and set CustomTool to MSDataSetGenerator)

It is either one or the another.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com


Frédéric Goulet said:
I generate an XML file with the WriteXmlShema method of the DataSet object.

Then, I use xsd.exe to make it a strongly typed DataSet, witch
generate
a MyDataSet.xsd
like
 

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