Questions tagged [onion-architecture]

The *Onion Architecture* is a software architecture proposed by Jeffrey Palermo. It is similar to the *Hexagonal Architecture* (Ports and Adapters) proposed by Alistair Cockburn.

Jeffrey Palermo proposed the Onion Arcitecture. It is similar to Alistair Cockburn's Hexagonal Architecture or Ports and Adapters.

The fundamental motivation of the approach is to avoid layer-to-layer dependencies usually associated with the N-tier architecture approach. This is achieved by placing all infrastructure, including databases, outside the problem domain.

According to Jeffrey Palermo:

The overall philosophy of the Onion Architecture is to keep your business logic and model in the middle (Core) of your application and push your dependencies as far outward as possible.

The problem domain is then completely independent of the required infrastructure (testing, databases, security, etc.). For example, this means that testing database accesses can be done thoroughly without a real database.

291 questions
65
votes
3 answers

Clean Architecture vs Onion Architecture

I have been reading up on the Onion Architecture and today I found out about Uncle Bob's Clean Architecture. For the life of me I cannot see any differences between them, they look identical (other than the naming convention). Is there any…
user3373870
  • 1,406
  • 2
  • 13
  • 17
63
votes
5 answers

Onion architecture compared to hexagonal

Is there any difference between them (onion | hexagonal), from my understanding they are just the same, they focus upon the domain which is at the core of the application and should be technology / framework agnostic. What are the differences…
54
votes
6 answers

Repository pattern and mapping between domain models and Entity Framework

My repositories deal with and provide persistence for a rich domain model. I do not want to expose the anemic, Entity Framework data entity to my business layers, so I need some way of mapping between them. In most cases, constructing a domain…
45
votes
3 answers

What is the relationship between DDD and the “Onion Architecture”?

What is the relationship between Domain-driven design (DDD) and "The Onion Architecture" of Jeffrey Palermo?
ulrichb
  • 19,610
  • 8
  • 73
  • 87
41
votes
6 answers

Onion vs. N-Layered Architecture

One thing beforehand: I arrive from an N-layered background. I have now spent quite a bit time getting my head around Onion Architecture and related Domain Driven concepts such as Hexagonal Architecture reading resources like Jeff Palermo's series…
38
votes
3 answers

Onion archicecture dependencies in the same layer: Infrastructure and Web communicating

I am designing an ASP.NET MVC application using the Onion Architecture described by Jeffrey Palermo. It is an ASP.NET MVC 2.0 project, where I am requiring that all views be strongly typed using dedicated View Models -- we will not be passing domain…
37
votes
7 answers

Onion Architecture - Repository Vs Service?

I am learning the well-known Onion Architecture from Jeffrey Palermo. Not specific to this pattern, but I cannot see clearly the separation between repositories and domain services. I (mis)understand that repository concerns data access and service…
Cybermaxs
  • 24,378
  • 8
  • 83
  • 112
24
votes
2 answers

Onion Architecture

I am setting up a project structure for an upcoming internal application trialling the Onion Architecture proposed by Palermo (http://jeffreypalermo.com/blog/the-onion-architecture-part-3/). I have followed his guidelines, however I need some…
Darbio
  • 11,286
  • 12
  • 60
  • 100
22
votes
3 answers

Onion Architecture, Unit of Work and a generic Repository pattern

This is the first time I am implementing a more domain-driven design approach. I have decided to try the Onion Architecture as it focuses on the domain rather than on infrastructure/platforms/etc. In order to abstract away from Entity Framework, I…
Dave New
  • 38,496
  • 59
  • 215
  • 394
20
votes
4 answers

Opinion on ASP.NET MVC Onion-based architecture

What is your opinion on the following 'generic' code-first Onion-inspired ASP.NET MVC architecture: The layers, explained: Core - contain the Domain model. e.g. that's the business objects and their relationship. I am using Entity Framework to…
hyankov
  • 4,049
  • 1
  • 29
  • 46
19
votes
1 answer

create DTOs, BOs and DAOs for NestJs REST API

I would like to get into creating REST APIs with NestJs and I'm not sure how to setup scalable layer communication objects. So from the docs on how to get started I come up with a UsersController dealing with the HTTP requests and responses, a…
Question3r
  • 2,166
  • 19
  • 100
  • 200
16
votes
3 answers

Generic repository to update an entire aggregate

I am using the repository pattern to provide access to and saving of my aggregates. The problem is the updating of aggregates which consist of a relationship of entities. For example, take the Order and OrderItem relationship. The aggregate root…
15
votes
3 answers

Where logging should go in onion architecture with DDD

I am developing a console application using onion architecture and domain driven design. I have a two domains, where I need to implement logging, I confused where I can place the logging component. Can I place that in respective infrastructure of…
14
votes
3 answers

Abstracting Identity 2.0 to domain model layer

I'm trying to implement Identity 2.0 in my ASP.NET MVC 5 solution that abides the onion architecture. I have an ApplicationUser in my core. namespace Core.DomainModel { public class ApplicationUser {...} } In my Data Access Layer I'm using…
Snæbjørn
  • 10,322
  • 14
  • 65
  • 124
14
votes
2 answers

Entity Framework 6 Database-First and Onion Architecture

I am using Entity Framework 6 database-first. I am converting the project to implement the onion architecture to move towards better separation of concerns. I have read many articles and watched many videos but having some issues deciding on my…
1
2 3
19 20