Questions tagged [onion-architecture]
The onion-architecture tag has no usage guidance.
64
questions
0
votes
3
answers
359
views
Mapping to and from domain entities
I am in the process of implementing onion / clean architecture, and would like to understand better how and when to map to my domain entities.
So if we take a specific example where we have a Post and ...
0
votes
2
answers
354
views
Onion architecture: Dependency Inversion Principle within the Service layer
I'm trying to implement a project using the Onion Architecture (aka Hexagonal, aka Ports and Adapters, aka Clean Architecture).
I understand that the user interface uses Service interfaces instead of ...
0
votes
1
answer
475
views
Encapsulation of External API in Infrastructure Layer AS Persistence
My question is about DDD, the Infrastructure layer, it's relation to the Domain, and specifically how we can take advantage of the ability to "swap out" one persistence implementation for ...
3
votes
2
answers
1k
views
What layer do third party API request/response models go in and what do you call them?
I have a RESTful API service that has three layers: Application/Domain, Infrastructure, and Presentation.
Application/Domain contain my interfaces and models. I currently have three different types of ...
1
vote
2
answers
155
views
Catch "foreign" exception in adapter and convert them in own business exception is a good practice?
I am currently thinking about some design choices regarding exception handling.
My current architecture looks a little like this:
You can see that I have a UI where a try-catch middleware is cathing ...
0
votes
3
answers
234
views
Pattern for passing request context to business logic
I'm working on a project in which I have a clear separation between domain logic and the logic that exposes these features using an API (or whatever). For this I'm using the Onion Architecture.
Now I ...
1
vote
2
answers
263
views
Where to put a deffiniton of an external data provider in a DDD/Onion Architecture application?
Consider that when working on an Application which is modelled using DDD and implemented using Onion Architecture, you come along a following business case:
The Application, as one of its features, ...
-1
votes
2
answers
164
views
How to avoid CRUD and layered architectures in REST backends?
I'm creating a .Net 5 API backend and use EF Core for the database part. The simple CRUD way I know:
API layer calling a command or query from the application layer using MediatR
Application layer ...
75
votes
11
answers
16k
views
Is it really possible to decouple the UI from the business logic?
I'm reading about software architectures like Hexagonal architecture, Onion architecture etc.
They put a big emphasis on decoupling. The business logic sits at the centre and the UI sits on the ...
-1
votes
3
answers
311
views
Preventing presentation layer from directly accessing repositories?
I'm trying to design my application in line with the "onion architecture" principles, and have something like the following:
HospitalController (depends on IHospitalService)
\
--- ...
1
vote
1
answer
356
views
How do proto models in gRPC fit into Clean Architecture
I know they say that clean architecture are guidelines, and individual projects will affect implementation, but is there a general thought on the correct implementation? A lot of times I see DTO ...
1
vote
3
answers
717
views
Do adapters get only called by usecases?
Suppose we have a layered architecture like onion architecture or clean architecture with three modules representing each layer:
domain.py
usecase.py
databaseadapter.py
The domain layer contains the ...
1
vote
1
answer
1k
views
How should infrastructure be able to reference repository interfaces in onion architecture?
In Jeffrey Palermo's article about Onion Architecture, he claims the following:
The first layer around the Domain Model is typically where we would find interfaces that provide object saving and ...
0
votes
1
answer
89
views
Architecture Layers - Interface project at the top
We have structured our application with typical layers. UI, Database access, services, Helpers etc.
However, at the very top we have a project called "Interfaces" which contains the ...
0
votes
1
answer
85
views
Mutli tenant app with onion architecture and multiple presentations
Currently I started designing a new multi tenant SaaS application based on the onion architecture in C#
Using a rest web API to expose my services and consume them on 3 platforms. Two web apps (one ...
1
vote
1
answer
161
views
Event logging - per Aggregate or one per Bounded Context?
I'm working on an application (using Onion Architecture) and I want to have good log of entities' changes.
I'm struggling to find any good examples of what are the best practices - and I want to ...
1
vote
2
answers
550
views
How to organize database access logic for the infrastructure and application layer when avoiding ORM tools?
I'm trying create a .NET Core project and followed some guides to create a basic architecture
Jason Taylor - Clean Architecture with ASP.NET Core 3.0
Sample project
Clean Architecture Template
I'm ...
1
vote
0
answers
80
views
Am I structuring this correctly for a .net mvc web app based on onion architecture?
]1
I am new to MVC. Most of my career I have used Web Forms in Asp.net. Reading about MVC has been really confusing because from what I have learnt is that in Traditional MVC, models were supposed to ...
-3
votes
1
answer
237
views
What is the simplest version of best practice application architecture for a backend in C# and ASP.NET Core WebAPI?
I know that in some contexts, best practice would be DDD, CQRS and EventSourcing, but in my case this would be too complicated of two reasons:
My team is beginners, and we want them to be productive ...
-2
votes
1
answer
476
views
What is a simple implementation of onion architecture for C# ASP.NET Core WebAPI and SQL db that is not full DDD and CQRS?
I'm a programming teacher. My students learn structured and then object oriented programming in JavaScript and C#. They learn SQL, MS SQL Server, Dapper and EntityFramework Core.
After this they ...
1
vote
1
answer
229
views
Define input and output interfaces for each application layer
I want to create a multi-layered backend architecture with a REST layer and GraphQL layer later on.
So let's say you would start with the basic layers controller, service, repository would it make ...
6
votes
3
answers
323
views
Where to convert primitive types in meaningful types in Clean Architecture / Onion Architecture
The book "Implementing Domain Driven Design" (page 361) suggests to use special types to distinguish several kinds of IDs, e. g. using BookId(1) instead of just 1 of type Int or Long. In my Clean ...
8
votes
1
answer
4k
views
Error handling in Nest service layer
I would like to create a REST API with NestJs. But I want to add GraphQL as another top level layer later on. So for the start I have the basic layers controller, service and TypeORM repository. Let's ...
6
votes
2
answers
4k
views
Avoiding Repository pattern - implementing Onion Architecture with DbContext only
I am trying to follow the Onion Architecture to design my application where I have the following layers -
Domain Layer: is the inner-most layer and defines repository interfaces
Infrastructure ...
0
votes
0
answers
88
views
Instantiating adapters in onion architecture
GitHub and NuGet
Do you use connection strings to instantiate your adapter services or just always configure it through IoC? I think that connection strings could provide a way more flexibility, ...
3
votes
1
answer
1k
views
Onion Architecture: Should Service Layer contain DB Context?
In Onion Architecture, we have repository layer which conducts Crud Operations (simple insert, delete, update). (Applying Entity Framework with database)
Onion Architecture
Additionally , we have ...
5
votes
1
answer
787
views
FP Free Monad vs OOP Dependency Injection
I've written my first moderately large project in functional style (in F#) and can see the advantages. The main challenge was to achieve the "Onion" architecture i.e. large and "smart" pure core / ...
1
vote
1
answer
707
views
Data entities in Onion Architecture
I'm trying to build a project using onion architecture (just a "Northwind"ish type app to get more up to speed with .NET Core). I also want to get a better grasp on Onion Architecture principals. I ...
7
votes
2
answers
6k
views
What are application and domain services in onion architecture?
Onion architecture has a core which is composed by domain model, domain services and application services:
I'm in doubt about those two service layers, domain services and application services.
I've ...
2
votes
1
answer
3k
views
C# .Net Core API design - interfaces vs DTOs
I'm designing a relatively simple web application using .net core. I've mostly done desktop development in my career so far, so I'm a bit new to the nuances between desktop and web development.
In ...
2
votes
1
answer
896
views
Domain Use Case
In my understanding of Uncle's Bob Clean Architecture, a Use Case (Interactor) is responsible for orchestrating the Entities. At the same time, it represents Application-specific rules. The business ...
-1
votes
1
answer
280
views
Onion Architecture - Multiple Apps
Onion Architecture talks about separating the UI, Service, and Data Layers. All the samples usually given for this involve a single deployment model of the application. For example in .net most of the ...
0
votes
1
answer
623
views
Am I breaking some Onion Architecture rule?
Based on the project structure below i will have some questions
Domain Layer
1) MyApp.Domain.Entities (DLL)
Product.cs
PagedResult.cs
Referentes
No References
2) MyApp.Domain.Interfaces (DLL)
...
2
votes
1
answer
2k
views
Use case interactions in clean architecture
I'm experimenting with Clean Architecture for my turn-based strategy game project. I have use cases that form hierarchies and need to be coordinated with each other. I would like some advice on how to ...
1
vote
1
answer
993
views
Onion architecture applied to an .NET application
I am trying to figure out how to translate the onion architecture into an ASP.NET Core WebAPI solution, this is what I ended up with:
Let's say I have an application that takes a file path / uri into ...
0
votes
2
answers
87
views
Structural problem related to Dependecy Injection and Asynchronous Operations
I'm implementing the onion architecture with webapi, service layer, repository, unit of work and the domain classes.
I use also DI, using simple injector.
But my issue, is how can I implement a ...
2
votes
1
answer
715
views
Onion Architecture, Project Architecting and Authentication
I am learning ASP.NET MVC & Web API and trying to implement Onion Architecture with Repository Pattern for one of my Test projects as part of my learning.
I have developed single MVC Projects ...
3
votes
1
answer
2k
views
Reusing business logic layer in multiple applications
I have seen some people asking about sharing business logic with more than one application, and answers generally discuss putting it in a class library. I'm fine with that, but usually the examples ...
0
votes
0
answers
607
views
Clarification on the Onion architecture's Domain Service and Application Service
I am studying Onion Architeture but i got some doubts:
All the samples (github) I found over internet are too simple, or are implemented under DDD (which I have not studied at the moment) so I can ...
17
votes
2
answers
10k
views
What data should a repository return
I have a simple project where the controller calls the service, and the service calls the repository in order to get the needed data.
Assuming that we have these domain models:
// this model has a ...
5
votes
2
answers
1k
views
Application service - part of Bounded Context?
I am having a hard time understanding where the Application Services fit in with DDD and Onion architecture. Up until a few days ago I thought of them as part of domain model, but I began to question ...
6
votes
3
answers
5k
views
Onion architecture: layer placement of business logic
Where should the business logic for a project that utilizes Onion Architecture be placed?
In my case, it's a C#-based project, utilizing Web API and possibly a MVC UI for the presentation. But ...
2
votes
1
answer
642
views
Can one app have several "subdomains" in DDD?
General Context
I started reading about layer based architectures like DDD, Onion, Clean Architecture etc. I am considering switching, but am currently unclear about how strict the "first level ...
3
votes
0
answers
197
views
Should I pass presenter to use case when implement clean archeiture using scala
This question came to me when I was trying implement Clean Architecture using Scala, and come across this post.
In the accepted answer, @candiedorange emphasis on the separation of responsibility, and ...
5
votes
1
answer
2k
views
Is there really such a thing as the onion architecture?
Note: BLL = Business Logic Layer (can also mean your domain)
I'm trying to understand the onion architecture. It seems to me that it's actually the same thing as the layered architecture, only with ...
2
votes
2
answers
337
views
Does a framework like the Spring Framework fall under the Data Centric Architecture?
With all the talk of Microservices with Domain Driven Design, I have been looking at two architectures, the Database-Centric Architecture and the Domain-Centric Architecture (Not to be confused with ...
2
votes
1
answer
248
views
How to realize "Tell, don't ask" in an Onion-Architecture for data analysis
I am currently thinking about how I would implement a software I did write some years ago with a Clean-/Hexagonal-/Onion-Architecture. This shall not be a "Grand Redesign from Heaven", since I'm not ...
1
vote
0
answers
628
views
Putting UnitofWork handler in the Request Model for DDD with Clean architecture?
I'm rearchitecting a system in Python, using SQLAlchemy for the data mapping layer, and the Zope Component Architecture for dependency injection and interface declaration. I am in the process of ...
6
votes
1
answer
3k
views
Where should I place configuration classes in Onion Architecture
We are redesigning one of our API projects from an n-layered architecture into onion architecture. In the previous design, we had configuration classes in a common library project being referenced ...
8
votes
2
answers
13k
views
How to structure an Onion project
Here is an example implementation using Onion architecture: https://www.codeproject.com/Articles/1028481/Understanding-Onion-Architecture
The webpage suggests a solution structure of:
Domain - ...