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 9063777
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:05:29+00:00 2026-06-16T16:05:29+00:00

I have had a dig around for an answer to this issue but everything

  • 0

I have had a dig around for an answer to this issue but everything previously asked seems to be a complex variation on this and doesn’t answer the question so I thought I should just ask.

I am developing a three tier application with the following…..

  • DAL – Data Access Layer using Entity Framework
  • BLL – Business Logic Layer
  • Web App – MVC Web Application

I have created an Entity Framework model, repository classes and my connection string is in the DAL App.Config file. I have now created my first class in the BLL and it references the DAL. When trying to test the following, very basic method I get an error relating to a missing connection string in the BLL.

public static List<DAL.Item> getItems() {

        List<DAL.Item> result = new List<Item>();

        DAL.Repositories.ItemRepository myRepository = new    DAL.Repositories.ItemRepository();
        result = myRepository.GetAll().ToList();

        return result;

    }

Why is the BLL looking for the connection string? Am I missing something really obvious here?

If I need to include the connection string across multiple layers, which defeats the purpose of the n-tier structure, then how is the best way to do this? Can anyone shed some light on this for me?

  • 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-06-16T16:05:29+00:00Added an answer on June 16, 2026 at 4:05 pm

    You are new-ing up an instance of the DAL which in turn will try to look at your configuration file (not found due to the scope being in the Business Layer / Unit Test. What you should do is look into Inversion Of Control (IoC) and inject the DAL into the Business Logic Layer. Then you can mock out your DAL that won’t try and actually hit the config file / database etc.

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

Sidebar

Related Questions

I have had a look all over, but it doesn't seem as though my
I have had a hunt but can't get this to work. If an input
I have had this problem crop up a few times and I can't figure
I have had several situations when i would like to do that. This could
I have had a few problems getting this right, so I wanted to ask
Have had this happen alot, I forget to select the .java file before running
I have had a good trawl through related questions and implemented suggestions found, but
I've had a good dig around and while I can find hints on how
We have had an issue with a block of code that responds poorly in
I have had C++ experience but not MSVC. What I am trying to do

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.