Link to home
Create AccountLog in
Avatar of bschave2

asked on

c# How do I manage database connections the three tier architecture?

Hi guys,

I am new to object oriented programming. I have programmed in the top down world for a few years now, but find that OOP is a more efficient way to program. my question is twofold really.

1. With the DAL, is the best practice having something like a dbhelper class and also having a separate DAL for each class that utilizes the dbhelper class? Or is it best practice to have a DAL for each class that processes your data for you?

2. With question number one in mind, what happens if I need to populate 8 drop downs in a class and I need to have 1 connection for all 8 drop downs? it ust seems like the db helper class would work against that. I want to manage my connections as much as possible.

thanks in advance!
Avatar of jimsweb
Flag of India image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
It certainly helps to have helper class which will have some static methods to remove the duplications.

I am not sure why you neew to have "1 connection for all 8 drop downs".

Have you thought about implement connection pooling? Assume that your DB Helper class has access to connection pool with 4 connections. If more connections are available, it will use it...may be this will improve the performance by some extent.

Just my 2 cents....