Question

I am starting a project in asp.net. I want to use 3 layer architecture. now I have problem with layers. I manage these layers like this:

enter image description here

but I have seen somewhere that uses App_Code and some other formats. could you please help me which one is true and standard?

Was it helpful?

Solution

App_Code is a special ASP.NET folder which is used by ASP.NET Websites. It is not used by precompiled ASP.NET applications. You can read more about the differences between the two in this article. So if UI is an ASP.NET Website you could use the App_Code folder to put some logic although this is better suited to external libraries as you have in your current design. This allows for better unit testability of this code and reusability.

OTHER TIPS

Avoid the use of App_Code. Anything you put in here doesn't compile until the site is executed. Any dependency that your forms and user controls have is best put into your UI layer, outside of the main web folder. You'll have a lot more peace with objects that are compiled early rather than later.

Now-a-days I see this standard a lot:

ProjectName
 -ProjectName.Core (All poco classes and interfaces)
 -ProjectName.Data (All entity framework stuff)
 -ProjectName.Service (All business logic)
 -ProjectName.Web (All font end logic)
  • "Core" is reference in all projects to move data around.
  • "Data" is referenced only in "Service".
  • "Service" is referenced only in "Web".
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top