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
13
votes
2 answers

Onion Architecture: Business Services Interfaces and Implementation

I am learning about the Onion Architecture. I have a confusion about the service layer, because I see some people saying that the core layer should only contain: Models Repository interfaces Services interfaces But others express that it also…
reliasr
  • 175
  • 1
  • 8
12
votes
2 answers

Domain Driven Design Onion Architecture with Django Rest Framework

I have been reading recently about Domain Driven Design (DDD), I like the concept and especially the idea of Onion architecture goes with it (https://www.youtube.com/watch?v=pL9XeNjy_z4). I am quite curious to understand how such an architecture we…
12
votes
3 answers

Decoupling ASP.NET Identity from the Core Domain Models - Onion Architecture

I am using this sample project (https://github.com/imranbaloch/ASPNETIdentityWithOnion) as my application architecture, in this sample the core is completly decoplied from the infrastrure including the identity framework. In this sample the author…
12
votes
2 answers

Bounded context implementation and design

Let's say I have two bounded contexts, the Shipping Context and the Billing Context. Each of these contexts need to know about the customer. At a data level, the customer is represented by a CustomerTbl table in a database. This table consists of…
11
votes
2 answers

What are the typical layers in an onion architecture?

I am currently studying the domain driven design, and try to apply it for a WPF project. I watched some tutorial videos, and read many articles, like : Onion archicecture dependencies in the same layer: Infrastructure and Web…
11
votes
2 answers

Dependency Resolution in Onion Architecture

The Onion Architecture is a way of structuring applications to maintain separation of concern and loose coupling (example project at: http://onionarch.codeplex.com/). Dependency Injection/Resolution is a key aspect of this architecture, since it is…
Vocte
  • 317
  • 1
  • 5
  • 11
10
votes
1 answer

Placement of view models/DTOs in onion architecture

I'm currently refactoring a ASP.NET MVC project to use the onion arcitecture since it seems that it suits the needs of future development. I have set up the layers which I think I need to use and my solution now looks like this: So, basically as…
Bo Mortensen
  • 935
  • 1
  • 13
  • 31
9
votes
2 answers

Separation of ASP.NET Core Identity ApplicationUser with relationship to Domain Model Entity

I'm trying to achieve good separation and architecture between ASP.NET Core Identity and entities in my domain model. I'm using an Onion architecture in a web application built with ASP.NET Core. In the core project, Domain, I have domain models,…
9
votes
1 answer

DDD Application Service Domain Model to View Model Mapping

My understanding of the application services are that they link between the domain and the user interface together. In other words, they serve the controller to perform operations on the domain. I have the following project layout in my…
9
votes
3 answers

Onion Architecture: Should we allow data annotations in our domain entities?

I am looking to implement the Onion Architecture into our ASP.NET MVC application. I understand the need to separate View Models from Domain Entities, however I am finding myself writing redundant code. There is redundant code because my view…
7
votes
1 answer

C# / DDD: How to model entities with internal state objects not instantiable by the domain layer when using onion architecture?

I am in the process of migrating a "big ball of mud" (BBOM)-like system towards a system based on the ideas of domain driven design. After various iterations of refactoring, domain aggregates/entities are currently modelled using inner state…
7
votes
3 answers

Should you have one-database-to-rule-them-all setup or separated database for each bounded context?

In DDD, as far as I understand it, it helps or guides you on how to structure complex application. Now in an application, you should identify your Bounded Context. Say you have more than 10 BCs. I read somewhere (forgive me I cannot give any links),…
Boy Pasmo
  • 8,021
  • 13
  • 42
  • 67
7
votes
1 answer

Onion Architecture Identity Framework

I am following Onion Architecture. And in that I am using ASP.NET Identity Framework. Here is my Project Structure: 1-Core - Domain Classes //It contains my T4 template classes -- AppUser //It is Identity User. - Repository…
7
votes
1 answer

Services and Authorization in Onion Architecture

I'm trying to learn Onion Architecture and as i understand, I've organized my solution as follows: Domain Domain.Entities (Business objects) Domain.Interfaces (Interfaces for domain services and repositories) Domain.Services (Implementation for…
Mahdy
  • 147
  • 3
  • 10
7
votes
3 answers

how to implement services and repositories on onion architecture?

I've been studying onion architecture for a couple of days. I understand that dependencies should always go toward the center and how to use dependency injection to accomplish this. But I have a couple of questions I still couldn't figure out. Can…
1
2
3
19 20