Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3627216
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:51:36+00:00 2026-05-18T23:51:36+00:00

If I want to create a 3-Layer ASP.Net application (Presentation Layer, Business Layer, Data

  • 0

If I want to create a 3-Layer ASP.Net application (Presentation Layer, Business Layer, Data Access Layer), where is the best place to create the Connection objects?

So far I used a helper class in my Presentation Layer to create an IDbCommand from the ConnectionString in the web.config on each page and passed it on to the DAL classes/methods.

Now I am not so sure, if this part shouldn’t also be included in the DAL somehow, because it obviously is part of the Data Access. The DAL is in a separately compilated project, so I dont have access to the web.config and cannot access the connection string (right?).

What is the best practice here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T23:51:37+00:00Added an answer on May 18, 2026 at 11:51 pm

    Short answer:

    The Connection objects, which represent a dependency to the database, should be created in (and known only to) the Data Access Layer.

    Long answer:

    When you say “3-Tier” do you really mean “tier” or do you mean “layer”? The former suggests a hard boundary, such as a service layer, between each tier. The latter is simply a logical separation within a single application context. Also, define in what way the DAL is “a separately compiled project”? It can access the config file for whatever application context is running the code. If it is its own tier, it would have some kind of service or something which has a config. If it’s just a layer, it can access the application’s main config.

    Ideally, anything that’s tied to and/or dependent on the database should exist only in the DAL. The rest of the application domain shouldn’t have to worry about the database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET application that uses a layered architecture e.g. presentation layer, business
I am writing an ASP.NET application which I have a UI layer, business logic
i have the following situation, i have a Reporting layer(stand alone) in asp.net application(NOT
I need to create an ActionResult in an ASP.NET MVC application which has a
I've an MVC application, which is divided into 3 layers: - Presentation - ASp.NET
In my ASP.NET MVC application, I have a project that contains all the business
I want to create a push web application. The service layer is built on
As I am learning and working on Asp.Net MVC application, I want to know
I want to structure my ASP.NET MVC 2 web application sensibly using Areas. The
I want to create a Java application bundle for Mac without using Mac. According

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.