DataSets and cs files

  • Thread starter Thread starter Rob Brown
  • Start date Start date
R

Rob Brown

Is there a way to get the .NET framework to generate a cs file
associated with a schema other than when the DataSet is modified?

Since the cs file is automatically generated based on the schema,
there is a discussion going on at work regarding whether this file
should be placed under source control, or generated each time the
projects are built.

The issue is, we don't know if it's even possible to generate the cs
file at build time versus editing the DataSet.


Thanks (hope I'm clear).


Rob
 
Rob Brown said:
Is there a way to get the .NET framework to generate a cs file
associated with a schema other than when the DataSet is modified?

Since the cs file is automatically generated based on the schema,
there is a discussion going on at work regarding whether this file
should be placed under source control, or generated each time the
projects are built.

The issue is, we don't know if it's even possible to generate the cs
file at build time versus editing the DataSet.

You can generate it automatically with the xsd utility.

For instance:

xsd /d /l:C# foo.xsd

will generate a dataset based on foo.xsd. Run just xsd.exe to get more
options.
 
Hi Rob,

I am using the default settings (cs file stored in source safe) and didn't
have any problems so far.
Is there a problem you have?
 
Hi Miha, Jon

Thanks for the response and tip.

There is no problem, per say. We were not sure if we should put the
generated cs file under source control. But we noticed the .NET
studio does not auto-generate the cs file when the project is grabbed
from source control onto a new system.

Placing the cs file under source control creates a problem if somebody
edits the DataSet without checking out the associated cs file. A new
cs file is created with a different filename, quietly.

We knew we could use the xsd utility, however, for every new dataset,
we have to do some (albeit, limited) editing to run it. It would be
nice if we were able to build the project without going through hoops
and hurdles.

We were hoping there is some project config setting that we couldn't
find along the lines of "Always Generate Dataset At Build Time".

Sounds like we need to use the xsd to generate these files.

Thanks again for the tip.


Rob
 
Hi Rob,

Rob Brown said:
Hi Miha, Jon

Thanks for the response and tip.

There is no problem, per say. We were not sure if we should put the
generated cs file under source control. But we noticed the .NET
studio does not auto-generate the cs file when the project is grabbed
from source control onto a new system.

Placing the cs file under source control creates a problem if somebody
edits the DataSet without checking out the associated cs file. A new
cs file is created with a different filename, quietly.

We knew we could use the xsd utility, however, for every new dataset,
we have to do some (albeit, limited) editing to run it. It would be
nice if we were able to build the project without going through hoops
and hurdles.

We were hoping there is some project config setting that we couldn't
find along the lines of "Always Generate Dataset At Build Time".
Sounds like we need to use the xsd to generate these files.

I don't know if you know :) but if you right click on xsd file in solution
explorer the popup menu gives you an option Run Custom Tool which does the
same.
 
Back
Top