Solved

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

Posted on 2011-02-13
4
792 Views
Last Modified: 2012-08-14
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!
0
Comment
Question by:bschave2
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Accepted Solution

by:
jimsweb earned 0 total points
ID: 34883237
What is a 3-tier architecture?

Three-tier (layer) is a client-server architecture in which the user interface, business process (business rules) and data storage and data access are developed and maintained as independent modules or most often on separate platforms. Basically, there are 3 layers, tier 1 (presentation tier, GUI tier), tier 2 (business objects, business logic tier) and tier 3 (data access tier). These tiers can be developed and tested separately.

What is the need for dividing the code in 3-tiers? Separation of the user interface from business logic and database access has many advantages. Some of the advantages are as follows:

    * Reusability of the business logic component results in quick development. Let's say we have a module that handles adding, updating, deleting and finding customers in the system. As this component is developed and tested, we can use it in any other project that might involve maintaining customers.
    * Transformation of the system is easy. Since the business logic is separate from the data access layer, changing the data access layer won¿t affect the business logic module much. Let's say if we are moving from SQL Server data storage to Oracle there shouldn¿t be any changes required in the business layer component and in the GUI component.
    * Change management of the system is easy. Let's say if there is a minor change in the business logic, we don¿t have to install the entire system in individual user¿s PCs. E.g. if GST (TAX) is changed from 10% to 15% we only need to update the business logic component without affecting the users and without any downtime.
    * Having separate functionality servers allows for parallel development of individual tiers by application specialists.
    * Provides more flexible resource allocation. Can reduce the network traffic by having the functionality servers strip data to the precise structure needed before sending it to the clients.

More on this:
http://www.codeproject.com/KB/architecture/three_tier_architecture.aspx
http://www.codeproject.com/KB/cs/Three_Layer_Architecture.aspx

Hoe the above articles throw some light into your requirement.
0
 
LVL 5

Expert Comment

by:jaiminpsoni
ID: 34887728
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....
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question