OOP design in .NET with databases

F

Friedl Neurauter

Check out the Data Access Objects (DAO) design pattern
proposed by E. Gamma in the Go4 book.
 
S

Slonjo

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top