Design Templates – Am I structuring this correctly for a .net mvc web application based on onion architecture?


Text) (https://imgur.com/a/ikwByd8) (! (Enter the description of the image here) 1

I'm new to MVC. Most of my career, I have used web forms in Asp.net. Reading MVC was really confusing because from what I learned, in traditional MVC, the models were supposed to be business logic as well as the models / in-house domain objects. But when it comes to Microsoft's MVC, the model means that View Models and MVC is right in the UI / Presentation layer. Now, I'm trying to combine that with the Onion / Clean architecture. I use the Busines Logic layer and the Service layer interchangeably, but for the sake of simplicity for this application.

So my web application basically queries a few CSV files. These are the player data where we have the biographies of the tennis players and their match records and their head to head records. Besides the obvious display of data in the user interface layer inside the view, this data has to be displayed very differently from the way it is stored, let's assume that there is also business logic decisions that are processed at the service / business layer.

Assuming that the application will become much larger than its starting point, I decided to use the repository model and not go directly to the data source. The repository classes and the corresponding interfaces therefore reside in Data Access Layer. All of these are closely related to each other, so if we decide to switch from CSV files to SQL DB, much of this layer will have to be rewritten. It is, so to speak, an outer layer.

The innermost layer is the model / domain objects that make sense from a logical point of view and do not necessarily match 1 to 1 with how they are stored in the database nor how they are displayed in the view. The 3 layers DAL, BL, UI can directly access these model classes. However, these are in their own projects and these depend on nothing outside of this project. From what I understand, this is where ignoring the technology is important because we want to be able to change DAL without a single one without any modifications required for that particular layer.

DI is used both for the Business layer to be able to use DAL and for the UI layer to use the functionality of the Business layer. There are no such separate DTOs and instead domain model objects are used for this.

This is how I intend to configure it for scalability and SoC. Can someone please point out the disadvantages of this and if I understand things correctly?