Typed DataSet in code...

  • Thread starter Thread starter Scott M.
  • Start date Start date
S

Scott M.

Can a typed DataSet be made in code so that code that comes after the type
code will pick up on the dataset's table structure for intellisense?
 
Hi Scott,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to use intellisense on a typed
DataSet when it is made in code. If there is any misunderstanding, please
feel free to let me know.

As far as I know, typed DataSets are made in code. When you have created
your .XSD file in IDE, VS.NET will generate class (.cs or .vb) file
automatically according to the schema files using xsd.exe. The generated
file will be put together with the schema. To see the .cs or .vb file that
has been generated, here are the steps:

1. Click on the button Show all files in the Solution Explorer.
2. If your typed DataSet is MyDataSet, expand MyDataSet.xsd in the Solution
Explorer.
3. Double click MyDataSet.cs or MyDataSet.vb to see the typed DataSet class
definition.

After you have built the project, the typed DataSet structure can be used
for intellisense. For example, if you have two tables in it, named
Customers and Orders, when you need to get the reference for one of the
tables, you can simple use myDataSet.Orders instead of
myDataSet.Tables["Orders"].

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Actually Kevin, my question is, can you make a typed dataset completely from
handwritten code, not using the IDE?
 
Only if you run xsd.exe against it. You can't do it dynamically at runtime
.. Well technically you can Process.Start(xsd.exe) but that won't get you
anything without a LOT of other work that is totally not worth it.

--
W.G. Ryan MVP Windows - Embedded

http://forums.devbuzz.com
http://www.knowdotnet.com/dataaccess.html
http://www.msmvps.com/williamryan/
Scott M. said:
Actually Kevin, my question is, can you make a typed dataset completely from
handwritten code, not using the IDE?

Kevin Yu said:
Hi Scott,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to use intellisense on a typed
DataSet when it is made in code. If there is any misunderstanding, please
feel free to let me know.

As far as I know, typed DataSets are made in code. When you have created
your .XSD file in IDE, VS.NET will generate class (.cs or .vb) file
automatically according to the schema files using xsd.exe. The generated
file will be put together with the schema. To see the .cs or .vb file that
has been generated, here are the steps:

1. Click on the button Show all files in the Solution Explorer.
2. If your typed DataSet is MyDataSet, expand MyDataSet.xsd in the Solution
Explorer.
3. Double click MyDataSet.cs or MyDataSet.vb to see the typed DataSet class
definition.

After you have built the project, the typed DataSet structure can be used
for intellisense. For example, if you have two tables in it, named
Customers and Orders, when you need to get the reference for one of the
tables, you can simple use myDataSet.Orders instead of
myDataSet.Tables["Orders"].

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Scott,

Why not?
Look the .cs class behind the xsd file -there is everything
MSDataSetGenerator created.

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

Scott M. said:
Actually Kevin, my question is, can you make a typed dataset completely from
handwritten code, not using the IDE?

Kevin Yu said:
Hi Scott,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to use intellisense on a typed
DataSet when it is made in code. If there is any misunderstanding, please
feel free to let me know.

As far as I know, typed DataSets are made in code. When you have created
your .XSD file in IDE, VS.NET will generate class (.cs or .vb) file
automatically according to the schema files using xsd.exe. The generated
file will be put together with the schema. To see the .cs or .vb file that
has been generated, here are the steps:

1. Click on the button Show all files in the Solution Explorer.
2. If your typed DataSet is MyDataSet, expand MyDataSet.xsd in the Solution
Explorer.
3. Double click MyDataSet.cs or MyDataSet.vb to see the typed DataSet class
definition.

After you have built the project, the typed DataSet structure can be used
for intellisense. For example, if you have two tables in it, named
Customers and Orders, when you need to get the reference for one of the
tables, you can simple use myDataSet.Orders instead of
myDataSet.Tables["Orders"].

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
I'm not asking if a typed DataSet can be represented by code. I'm asking if
I can make one completely in code (no VS .NET drag & drop) and still get
intellisense when I use the DataSet.


Miha Markic said:
Hi Scott,

Why not?
Look the .cs class behind the xsd file -there is everything
MSDataSetGenerator created.

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

Scott M. said:
Actually Kevin, my question is, can you make a typed dataset completely from
handwritten code, not using the IDE?

Kevin Yu said:
Hi Scott,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to use intellisense on a typed
DataSet when it is made in code. If there is any misunderstanding, please
feel free to let me know.

As far as I know, typed DataSets are made in code. When you have created
your .XSD file in IDE, VS.NET will generate class (.cs or .vb) file
automatically according to the schema files using xsd.exe. The generated
file will be put together with the schema. To see the .cs or .vb file that
has been generated, here are the steps:

1. Click on the button Show all files in the Solution Explorer.
2. If your typed DataSet is MyDataSet, expand MyDataSet.xsd in the Solution
Explorer.
3. Double click MyDataSet.cs or MyDataSet.vb to see the typed DataSet class
definition.

After you have built the project, the typed DataSet structure can be used
for intellisense. For example, if you have two tables in it, named
Customers and Orders, when you need to get the reference for one of the
tables, you can simple use myDataSet.Orders instead of
myDataSet.Tables["Orders"].

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Scott,

I am not sure I understand you.
Typed dataset is code, acutally it is a class derived from DataSet.
The designer does just that - it converts xsd into a class derived from
DataSet which is later used by ide.
You can freely create it by yourself - it is no magic there.

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

So, if you code your own typed dataset
Scott M. said:
I'm not asking if a typed DataSet can be represented by code. I'm asking if
I can make one completely in code (no VS .NET drag & drop) and still get
intellisense when I use the DataSet.


Miha Markic said:
Hi Scott,

Why not?
Look the .cs class behind the xsd file -there is everything
MSDataSetGenerator created.

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

Scott M. said:
Actually Kevin, my question is, can you make a typed dataset
completely
from
handwritten code, not using the IDE?

Hi Scott,

First of all, I would like to confirm my understanding of your
issue.
From
your description, I understand that you need to use intellisense on a
typed
DataSet when it is made in code. If there is any misunderstanding, please
feel free to let me know.

As far as I know, typed DataSets are made in code. When you have created
your .XSD file in IDE, VS.NET will generate class (.cs or .vb) file
automatically according to the schema files using xsd.exe. The generated
file will be put together with the schema. To see the .cs or .vb file
that
has been generated, here are the steps:

1. Click on the button Show all files in the Solution Explorer.
2. If your typed DataSet is MyDataSet, expand MyDataSet.xsd in the
Solution
Explorer.
3. Double click MyDataSet.cs or MyDataSet.vb to see the typed DataSet
class
definition.

After you have built the project, the typed DataSet structure can be used
for intellisense. For example, if you have two tables in it, named
Customers and Orders, when you need to get the reference for one of the
tables, you can simple use myDataSet.Orders instead of
myDataSet.Tables["Orders"].

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Again Miha, I understand that the RESULT of the designer is code that I
could have written myself. But the designer also creates an XSD file, which
is the basis for the intellisense that you get when coding against the
dataset in other spots in the code. My question was can I get the
intelliSense of a typed DataSet, when making a dataset by hand (not with the
designer), and thus, without an xsd file.


Miha Markic said:
Hi Scott,

I am not sure I understand you.
Typed dataset is code, acutally it is a class derived from DataSet.
The designer does just that - it converts xsd into a class derived from
DataSet which is later used by ide.
You can freely create it by yourself - it is no magic there.

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

So, if you code your own typed dataset
Scott M. said:
I'm not asking if a typed DataSet can be represented by code. I'm asking if
I can make one completely in code (no VS .NET drag & drop) and still get
intellisense when I use the DataSet.


Miha Markic said:
Hi Scott,

Why not?
Look the .cs class behind the xsd file -there is everything
MSDataSetGenerator created.

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

Actually Kevin, my question is, can you make a typed dataset completely
from
handwritten code, not using the IDE?

Hi Scott,

First of all, I would like to confirm my understanding of your issue.
From
your description, I understand that you need to use intellisense
on
a
typed
DataSet when it is made in code. If there is any misunderstanding,
please
feel free to let me know.

As far as I know, typed DataSets are made in code. When you have created
your .XSD file in IDE, VS.NET will generate class (.cs or .vb) file
automatically according to the schema files using xsd.exe. The generated
file will be put together with the schema. To see the .cs or .vb file
that
has been generated, here are the steps:

1. Click on the button Show all files in the Solution Explorer.
2. If your typed DataSet is MyDataSet, expand MyDataSet.xsd in the
Solution
Explorer.
3. Double click MyDataSet.cs or MyDataSet.vb to see the typed DataSet
class
definition.

After you have built the project, the typed DataSet structure can be
used
for intellisense. For example, if you have two tables in it, named
Customers and Orders, when you need to get the reference for one
of
the
tables, you can simple use myDataSet.Orders instead of
myDataSet.Tables["Orders"].

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Scott,

I think you can feel free to create a DataSet by hand and get intellisense,
since the .xsd file is used for generating the .cs file for class. Just
derive from DataSet class to do it.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top