H
H
Henry_Every2020-05-15 22:28:28
ASP.NET
Henry_Every, 2020-05-15 22:28:28

How to build a "pure" Onion architecture of an ASP.NET application?

Hey Habr! Now I am actively writing a small project (online bookstore) on ASP.NET MVC (.NET Framework). I chose Onion as the architecture. I understand that a three-layer one is probably better, but I want to study this particular way of organizing a project. So, in the "core" I have Domain Models, this is understandable. Then, at the Domain Services level, I have the IRepository and IAsyncRepository interfaces, everything is also clear here. Then I started having problems .... At the ApplicationServices level, I have classes that implement the IRepository and IAsyncReository interfaces, DbContext is also located there (I use EF6 as an ORM). Questions: is it right to place specific repository classes in the application services layer? Or is it better to leave them at the level of domain services? Just on different resources / diagrams in different ways. And one moment: at the heart of the application, I have the OrderedProduct class and the Cart class, in which I have the logic for adding a new product to the cart. Is it right to leave these classes in the layer of domain models, because this is a subject area, on the other hand, there is already some kind of logic (which will be changed / expanded in the future) and this is already an application service?

PS I understand that the division at the level in software architectures is very conditional, you can implement it in different ways ... But I still want to get the opinion of people who have encountered this and get their opinion so that in the future I don’t have to refactor the entire project completely .Thank you for your attention.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question