473,586 Members | 2,776 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about Class Hierarchy and ADO.Net


Hello,

I am wondering about best practices for class hierarchies and using
ADO.Net, especially the DataSet update/delete commands and the data
relations... this needs to package/unpackage to xml for client/server
sending. The class properties pretty much correspond to database tables.

This is a pretty long question so thanks in advance for reading and
commenting!

Clinics class - collection of Clinic objects
Clinic
Guid
Name
(a few other properties)
Exams class - collection of Exam objects
Exam
Guid
CreateDate
CreateByUserGui d (User class)
SpecialistUserG uid (User class)

Captures class - collection of Captures
Capture
Guid
Date
CaptureTypeCode
etc.

Users class
User
Guid
Name
Email

In VB6 for the singular classes (Exam, Clinic, Capture), I used a
private adodb recordset fields variable (with the schema from the table)
to hold most of the variables, and the get and let methods getting and
letting from the rs field. eg,

private m_fields as ADODB.Fields

Public Property Get Name() As String
Name = m_fields("Name" )
End Property

Friend Property Let Name(vData As String)
m_fields("Name" ) = vData
End Property

I also had an update method which updated the table directly from the
fields variable or sent in the values of the fields to an AddUpdate
stored proc. The collection classes (Exams, Clinics, Captures) also had
an update method which went through all the singular objects and called
that update method.

The main advantages of this was that having a recordset was more
efficient then having local variables for each property and having to
set all of them vs just setting a recordset. also clean and easy code,
and extensible by adding new fields to the db table. The disadvantage
was that each there was a lot of database hits to build the whole object
(even with lazy loading) - because as we get further building the
hierarchy, we can query for the same user guid for example. ie,

Exam instance #1 does a query for UserGuid 123
Exam instance #2 does a query for UserGuid 222
Exam instance #3 does another query for UserGuid 123
Exam instance #5 does another query for userGuid 222

So, to get to the heart of my question, I would like to use ado.net's
new features to do two things across class boundaries...

(1) from a collection class (Exams) with a dataset and add/update/delete
commands defined, to send individual datarows to each individual class
(exam), sort of like pass in the datarow by reference. Thus, I can do
an update from the collection class level (Exams) with those
add/update/delete commands. I would also like to be able to do an
add/update/delete from the individual class level too (Exam), because I
would like to be able to easily create a new Exam or whatever. Also, I
would like to package it up as xml and then open it on another computer
and save to db.

(2) use ado.net's data relation to reduce the amount of sql queries...
for example with my object model above, I would like to do one query for
all Clinics that meet a criteria, then one query for all the exams in
those clinics, then all the captures for those exams, then all users for
the exams and clinics, etc. if i had to do it in a similar way i id it
in vb6, i guess i could use some caching techniques and checking to see
if i have gotten that guid for a particlar class already?

Note that I don't want to do anything like use static varibles to hold
DataSets with relations, because I want to be able to have multiple
instances obstantiated without interfering with each other.

Any ideas, comments, pointers or references highly appreciated... most
of the ado.net books and articles seem to be for a more two tiered
approach with using ado.net in the presentation layer, i would like to a
more n-tiered approach.

many thanks,

-ed
Nov 16 '05 #1
0 1605

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
1472
by: Gonçalo Rodrigues | last post by:
Hi all, (note: newbie alert) Suppose you have a hierarchy of objects that you deal with via smart pointers, e.g. something like: template<typename T> class Ref { private:
31
1964
by: grahamo | last post by:
This came up in an interview I did a while ago and I wanted to know the correct answer. The setup is this; If I have a base class "food" and also two classes "meat" and "veg" that inherit from food, thus; food / \ / \ meat veg
12
2815
by: Meya-awe | last post by:
I am puzzled, what is the purpose of an interface? How does it work, what i mean is how does the compiler treats this? Why when we talk about separating user interface from business logic, an interface is declared, what is it's purpose? thanks, BRAMOIN *** Sent via Developersdex http://www.developersdex.com ***
24
1996
by: Kalpesh | last post by:
Hello All, Please help validate this design problem Assume that I have several entities in my project (eg Supplier, Customer etc). All of them save several common properties - name, address, city, state, zipcode etc I thought of making a base class - BusinessEntity (with all of the
2
1500
by: K Viltersten | last post by:
Suppose there is the following class structure. class S {...} class A : S {...} class B : S {...} class A1 : A {void m(){...}} class B1 : B {void m(){...}} class B2 : B {...} Just to clarify the issue. A1 and B1 share a method (void m() ) AND B2 doesn't have that
0
8200
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6610
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2345
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.