A Multi-Layer Back-End Application Architecture in .NET Core
This article discusses the architecture of a back-end application with .NET core.
Multi-Layer application architecture makes it easy to manage complex modern applications and makes it easier to work in a more agile manner. Therefore, it is very easy to implement DevOps processes and make the application life cycle more agile in an application designed in multi-layer architecture.
Multi layered applications consists of multiple layers, each of which corresponds for a different specific responsibility. Separating the layers and responsibilities in this way makes it very easy to develop and maintain the application.
In preparing this article, I will use a multi-layered architecture project that I prepared using the .NET Core I shared in GitHub. I believe that there are some very useful code examples for you in this project. You can reach and check the project from the link below.
Layers
The folder structure of a multi-tier application prepared using .NET core in Visual Studio IDE can be created as follows. The project is called Ponente.
Let’s take a closer look at each part of this application.
Core Layer
Core layer contains the necessary services and tools for all layers. This layer is project independent and develops according to the technologies used. In the architecture I shared above, the core layer contains common abstract classes and generic repository objects for the Entity Framework. In addition to these, it is generally expected to host the necessary common structures such as caching, logging, HTTP, infrastructure, dependency injection etc.
This layer is placed perpendicular to other layers in multi-layer architectural structures. Because it does not provide data communication between two layers or between two tools. It only provides the service requested from it.
Entity Layer
This layer contains abstract, concrete and data transfer objects that are used or implemented directly on all other layers.
Data Layer
The data layer is responsible for sending and receiving data to the database. This layer includes the services and tools needed to communicate with the database. In layered architectures it is usually located at the bottom layer.
Business Layer
Business layer is responsible for evaluating the data from the API layer according to the specified business logic and sending it to the data layer or passing raw data drawn from the data layer to the desired structure and passing it to the API layer. It is the layer that contains the logic and sets of rules and the services and tools necessary to perform this function.
API Layer
In multi-layer architecture applications, API, or service layer, is the top layer that presents the functionality of the application to the end user.
This is important to know that this layer is only responsible for exposing functionality of the application. It should never include business logic and accessing to the data.
In order to implement SOLID rules correctly, all layers were engineered on concrete classes in the implementation of abstract objects.
Takeaway
I hope you are satisfied with the information I have shared with you through this article. Please feel free to contact me — visit my LinkedInThanks!