C
Chris
I have the following setup:
1. 5 tables in a SQL database:
- Protocols
- Readers
- Participants
- Items
- Comments
2. The relationships between the tables are as follows:
- Protocols can contain multiple Readers, Participants and Items
- Items can contain multiple Comments
I am using these objects in an ASP.NET application which explains why I
don't want to retrieve more data than necessary in each of the following
questions. A DataSet containing all the data would be too big for the
Cache, Session or Application objects. My questions are as follows:
1. Should I use a single typed DataSet containing all the tables? I can
see how this might be a good solution with good relation maintenance
etc. but what about if I want to return a list of the Name field from
each Protocol row? I don't want to retrieve each Protocols row's
Readers, Participants and Items rows and each Items row's Comments rows
when all I'm interested is the Name field from the Protocols table. I
might often want to retrieve a subset of Protocols aswell. Using a
DataView would mean that the whole table would get retrieved and then
get filtered, causing excess network traffic and processing.
2. How would I retrieve a single Protocols row and put it into the typed
DataSet with its Readers and Participants loaded into DataTables in the
typed DataSet?
3. How do I set the SourceColumn property for my SqlCommand.Parameter
objects? In untyped datasets this is as simple as setting it to the
late-bound Column.Name property. Is it the same for typed DataSets? This
would, as far as I know, take away the advantage of early-binding in
typed DataSets.
Am I simply using the wrong tools at the wrong time here? One example of
a function in my ASP.NET application is my "Protocol Wizard" which spans
over 4 pages. 1 page for Protocols row information, 1 for Participants
and 1 for Readers. My solution was to create a class that could contain
the data in a couple of strings and ArrayLists and store an instance of
the class in the Session object for the duration of the wizard. When the
user views the 4th page which is a summary of the first 3 and confirms
the data entered, I manually move the class's data into the SQL
database. This works but I can't help feeling that I shouldn't be making
my own classes for data storage when the System.Data namespace already
has a whole plethora of objects for storage, management and
transportation of data. Doing things typed should make things even
better.
Regards
Chris
1. 5 tables in a SQL database:
- Protocols
- Readers
- Participants
- Items
- Comments
2. The relationships between the tables are as follows:
- Protocols can contain multiple Readers, Participants and Items
- Items can contain multiple Comments
I am using these objects in an ASP.NET application which explains why I
don't want to retrieve more data than necessary in each of the following
questions. A DataSet containing all the data would be too big for the
Cache, Session or Application objects. My questions are as follows:
1. Should I use a single typed DataSet containing all the tables? I can
see how this might be a good solution with good relation maintenance
etc. but what about if I want to return a list of the Name field from
each Protocol row? I don't want to retrieve each Protocols row's
Readers, Participants and Items rows and each Items row's Comments rows
when all I'm interested is the Name field from the Protocols table. I
might often want to retrieve a subset of Protocols aswell. Using a
DataView would mean that the whole table would get retrieved and then
get filtered, causing excess network traffic and processing.
2. How would I retrieve a single Protocols row and put it into the typed
DataSet with its Readers and Participants loaded into DataTables in the
typed DataSet?
3. How do I set the SourceColumn property for my SqlCommand.Parameter
objects? In untyped datasets this is as simple as setting it to the
late-bound Column.Name property. Is it the same for typed DataSets? This
would, as far as I know, take away the advantage of early-binding in
typed DataSets.
Am I simply using the wrong tools at the wrong time here? One example of
a function in my ASP.NET application is my "Protocol Wizard" which spans
over 4 pages. 1 page for Protocols row information, 1 for Participants
and 1 for Readers. My solution was to create a class that could contain
the data in a couple of strings and ArrayLists and store an instance of
the class in the Session object for the duration of the wizard. When the
user views the 4th page which is a summary of the first 3 and confirms
the data entered, I manually move the class's data into the SQL
database. This works but I can't help feeling that I shouldn't be making
my own classes for data storage when the System.Data namespace already
has a whole plethora of objects for storage, management and
transportation of data. Doing things typed should make things even
better.
Regards
Chris