473,508 Members | 2,303 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

OOP design in .NET with databases

Check out the Data Access Objects (DAO) design pattern
proposed by E. Gamma in the Go4 book.
-----Original Message-----
I am struggling with a design issue using .NET.
Let's say we have an object model and now want to code it. In the objectmodel is an Access database. Most programmers would start a new project andslap a connection and data adapter object on a form and start coding.Unfortunately this could not possibly fit any object model ever conceived.I am trying to determine best practices with this issue. My suggestion isthe following:

Encapsulate the database into a class. This class would be an aggregate ofother objects such as Customer, Company, etc. All needed collections such ascustomer names would be other objects. There would be methods in the classfor accessing the database and filling the properties as needed.
Does anyone have comments on this? All the books I have read on ADO.NETslap connections and data adapters onto the main form. This doesn't seem tobe very scalable. Is this the way people are really building .NETapplications?

Regards
Jerry
.

Jul 19 '05 #1
1 1694
Wizards... FAH!

I've also written my own Data Access Block that the app's data access
object (DAO) inherits. It handles connections and common SQL method
calls to eliminate redundant coding.

The project's data access class contains all the app's SQL and is
exposed through a global property that all the other object classes in
the project can see/use.

Module AppCommon

Private m_objDA As MyDataAccessObject

Friend ReadOnly Property g_DAO() As MyDataAccessObject
Get
If m_objDA Is Nothing Then m_objDA = New MyDataAccessObject()
Return m_objDA
End Get
End Property

End Module

So from anywhere in my *.dll it's simply g_DAO.FetchMyResults or
g_DAO.cn to get to the database.

I also use stored procs.

Compartmentalization is a good thing.
Jul 19 '05 #2

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

Similar topics

3
1386
by: db_happy | last post by:
Hi I need some design info. Say that I need to create an educational lab for databases with SQL Server. I need all the users to be able to execute common SQL commands ( create - alter – drop...
10
2087
by: BlueDolphin | last post by:
I'm not sure if this is a question or more of a rant... but I'm looking for some input on this from other developers out there. How often has the following happened to you and how have you dealt...
15
2123
by: kimi | last post by:
I have just started working on a project that is partially complete. It is an application that is using access to store test results. The test results are being stored in two Access 2000 databases....
5
1512
by: Aya9877 | last post by:
Alright, I have no idea what level book I need. I have a basic/decent background in coding. I am advanced in query building. I have a decent understanding of Visual Basic and some VBA. My...
10
2111
by: Saso Zagoranski | last post by:
hi, this is not actually a C# problem but since this is the only newsgroup I follow I decided to post my question here (please tell me where to post this next time if you think this post...
29
3537
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
5
1968
by: jensenat | last post by:
Hi, I am in the process of develop a multiuser application. I started today with the database design and I am not sure how to proceed, I have two ideas, but since I am not sure which one will be...
23
2400
by: JohnH | last post by:
I'm just recently come to work for an auto brokerage firm. My position involves performing mysterious rites, rituals and magick in order to get information out of their access database. This is...
3
2473
by: vicky | last post by:
Hi All, Can u please suggest me some books for relational database design or database modelling(Knowledgeable yet simple) i.e. from which we could learn database relationships(one to many,many to...
22
3639
by: Jesse Burns | last post by:
I'm about to start working on my first large scale site (in my opinion) that will hopefully have 1000+ users a day. ok, this isn't on the google/facebook scale, but it's going to be have more hits...
0
7224
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7380
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7494
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5626
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,...
1
5050
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...
0
3192
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...
0
3180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1553
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 ...
0
415
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.