Question

I usually create dataset as DAL, and BLL INSIDE the original project.

After I learned Entity Framework, I know that business logic layer are commonly created in separated project(class library).

However, ASP.NET site has no corresponding tutorial.

For this reason, I'm quite confused when I create BLL especially during referencing.

  1. In order to complete the BLL classes, am I supposed to directly add reference like this?

enter image description here

and then access to the entity with USING statement:

enter image description here

However, the presentation layer in main project which accesses BLL might need to reference back to BLL project. I saw some of the samples putting the entire BLL project's DLL file in the main project.

What's the correct way to reference BLL and Main project, or just reference as above?

Are there any good tutorial I can study from?

Was it helpful?

Solution

I normally setup a data access project, setup a business project that has a reference to the data access project, and a web project with references to both the data access and business project. With entity framework, all of the generated classes are in the data access layer. I normally use the repository pattern, which all of my repositories are in the business layer (could be in the data access layer too), and return the entity framework entities to the caller, which is an object in the presentation layer (an MVC controller, or an MVP presenter, or the code-behind of an asp.net web form, depending on what you are using).

HTH

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top