Update auto generated xsd files manually

  • Thread starter Thread starter Joe Thompson
  • Start date Start date
J

Joe Thompson

Hi,

I am using VS 2005 to write a C# app that uses an Access Database.

I am pretty new to it so I'm not sure how the my dataset.xsd file actually
was
created but I noticed that one of my db fields kept getting rounded to an
integer
instead of a single. I edited the xsd file and changed the DataProvider for
the field from Int32 to Single for the various INSERT, SELECT, UPDATE areas
in
the file and it seems to have corrected the problem.

Now I'm wondering if this file will be overwritten with the same mistake the
next time I make a change to the database schema? I'm not very familiar with
the xsd file I just happened to stumble across it while searching for the
cause of my problem.

Thank for any input,
Joe
 
Hi,

I am using VS 2005 to write a C# app that uses an Access Database.

I am pretty new to it so I'm not sure how the my dataset.xsd file
actually was
created but I noticed that one of my db fields kept getting rounded to
an integer
instead of a single. I edited the xsd file and changed the
DataProvider for the field from Int32 to Single for the various
INSERT, SELECT, UPDATE areas in
the file and it seems to have corrected the problem.

Now I'm wondering if this file will be overwritten with the same
mistake the next time I make a change to the database schema? I'm not
very familiar with the xsd file I just happened to stumble across it
while searching for the cause of my problem.

Overall, running the right click Custom Tool option updates DataSets
without much of a problem. This is not always true, as working with
changed connections is an issue.

If you change connections, you can end up with artifacts scattered
throughout the XSD and its code behind that make it nearly impossible to
get it working properly without manual surgery. In these cases, you need
to rebuild the XSD from scratch, which is a pain.

Another option is to adopt a Repository pattern and always supply the
connection string. This means you set the connection yourself, 100% of
the time. There are three benefits:

1. Since you are not reliant on the drag and drop connection, you have
full control and know you will hit the database you desire.

2. The code is easier to test. This is a bit too complex to get into
depth with.

3. Your app is tiered so the data bits are not strongly coupled to the
other tiers. This makes it more flexible and reusable.

I love the drag and drop bits to speed up my coding. But I don't rely on
everything they give me. Just a heads up.

Peace and Grace,


--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top