C# – Should I use different projects for building different layers in a 3-layer model

Architecturecdesign

I am creating a new project from scratch and have decided to use a 3-layer model.

I am using:

  • the 1st layer for business entities,
  • the 2nd layer for business logic,
  • and the 3rd layer for data logic layer.

Do I need to create different projects for these different layers or do I need to create different folders in one project?

What are the pros and cons of both approaches?

Best Answer

I would most definitely create 3 separate projects for each layer you hope to create. By using separate projects it makes your solution much more discoverable and maintainable.

To read a bit more on when to divide up projects see this answer

In the solution that you create you can make solution folders that nicely segregate the projects into more manageable areas.

You can have solution folders that are named after each layer you want to create.

  • Business Entity
  • Business Logic
  • Data Logic Layer

SolutionFolder

Related Topic