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?