By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,148 Members | 1,370 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,148 IT Pros & Developers. It's quick & easy.

Generating Datasets - Tricky Question

P: n/a

Is there any tool that generates Typed DataTables rather than Typed
Datasets? The trouble we are having is we have quite a few tables in
our database and a single table can be a part of more than one dataset.
If we use the XSD.Exe, the datatable definitions are repeated in every
dataset they appear in; causing our data definition layer to bloat.

Let us say there is a database table called Account which appears in
two dataset definitions - AccountData and TransactionData, XSD.Exe
creates two copies of Account datatable. This is very bad design as the
same underlying table is represented as different .net types.

We have looked at CodeSmith but it does not seem to provide any
out-of-the-box templates for what we are looking. We could write our
own templates but we are trying to avoid it to see if there is a better
way of coping with the problem.

Thanks.

May 11 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
I'm assuming that the Account database table is a single table that is being
represented in 2 different DataSets. Am I correct? If so, why are you using
2 different DataSets for the same Database? A single DataSet can represent
an entire Database if desired.

It is important to note that simply creating a DataSet involves no database
interaction (other than the code creation process). Objects in the DataSet
are not populated until you say they are. In other words, there is no reason
that you should need 2 different DataSets that overlap, and in fact, this
could lead to problems with synchronization of the data across both
(disconnected) DataSets.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.

"S Chapman" <s_*********@hotmail.co.uk> wrote in message
news:11**********************@u72g2000cwu.googlegr oups.com...

Is there any tool that generates Typed DataTables rather than Typed
Datasets? The trouble we are having is we have quite a few tables in
our database and a single table can be a part of more than one dataset.
If we use the XSD.Exe, the datatable definitions are repeated in every
dataset they appear in; causing our data definition layer to bloat.

Let us say there is a database table called Account which appears in
two dataset definitions - AccountData and TransactionData, XSD.Exe
creates two copies of Account datatable. This is very bad design as the
same underlying table is represented as different .net types.

We have looked at CodeSmith but it does not seem to provide any
out-of-the-box templates for what we are looking. We could write our
own templates but we are trying to avoid it to see if there is a better
way of coping with the problem.

Thanks.

May 11 '06 #2

P: n/a
>>there is no reason
that you should need 2 different DataSets that overlap,
<<

The above statement may not be entirely correct.

May 15 '06 #3

P: n/a
I agree with Kevin... you have to explain your design in more detail.
It's not clear to me why you have the same DataTable in multiple
DataSets within your data layer. I would have thought that a more usual
design would have been one DataTable (or a header / detail pair) per
data layer object, and then have the objects manage the relationships
between the different entities in your system.

Obviously there is a reason why you did what you did. Help us
understand the reasoning, and maybe we can come up with a solution to
your problem.

May 15 '06 #4

P: n/a
Thanks Bruce, ideally we would like to have one datatable class per
database table. We have a service based architecture in which the UI is
very loosely coupled with the middle tier. We tend to return max
information for every request. Let us say the UI requests all
transactions for a given account, we would have one dataset that
contains two datatables, one for Transactions and the other for Account
information as invariably the UI will not just display the transactions
but also some account information. Now, there might be another instance
when the UI is just updating the Account details - for this there would
be another dataset containing just the Account dataTable (and may be
additional tables for Credit and Debit card details and so on). So, we
do have situations when a DataTable appears in more than one dataset. I
hope I have explained the situation clearly.

If we use the XSD.Exe we will end up with many instances of Account
datatable class (one per dataset) which is undesirable.

May 17 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.