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

In a layered architecture, how can the Application layer know about Web URLs?

I'm currently working on a .NET 5 app that is using a layered architecture (Web / Application / Infrastructure / Domain). If I am to follow the onion/clean architecture pattern, the dependencies should flow in one direction only, e.g: Web ->…
leuquim
  • 636
  • 6
  • 16
6
votes
2 answers

In onion, hexagonal, or clean architecture, can a domain model contain different properties than the domain model in the database?

I am asking you who know well and have experience in building a software using any layered architecture (onion, hexagonal, clean, etc.). Whenever I google about the software architecture, people have different perspectives and explain the same…
6
votes
1 answer

Can hibernate business objects be used as entities in a clean architecture?

In our project we use classes generated by eclipse hibernate plugin for persistence. The generated classes have following structure. MyClass extends BaseMyClass //POJO's, that are refenced in the hbm files MyClassDAO extends BaseMyClassDAO //DAO…
6
votes
1 answer

DDD structure example

I am trying to structure an application using DDD and onion/hexagonal/clean architecture (using Java and Spring). I find it easier to find guidance on the concepts themselves than actually how to implement them. DDD in particular seems rather…
6
votes
1 answer

How to use ToDataSourceResult from KendoUI in Onion Architecture withouth exposing IQueryable

I am designing application with Onion architecture and I would like to use grid from Kendo UI with server side filtering sorting and paging. I would like to avoid manually parsing DataSourceRequest into dynamic LinQ, but use ToDataSourceResult…
afx
  • 61
  • 6
6
votes
3 answers

Logging interface in domain layer

I've got some really expensive business logic inside my domain layer where the data must be tracked in order to get a picture of what happened if something fails. Because of this, I want to declare a simple logging interface: public interface…
xvdiff
  • 2,179
  • 2
  • 24
  • 47
6
votes
2 answers

Unity: Implicit ResolvedParameter for unnamed registrations

The UserService constructor has two parameters, a IUnitOfWork and a IUserRepository: public UserService(IUnitOfWork unitofWork, IUserRepository userRepository) { ... } I am using named registrations to differentiate between multiple instances of…
6
votes
1 answer

Layered Architecture with DI vs onion architecture?

Could anyone please explain the difference between onion architecture and Layered architecture using dependency inversion? They look exaclty the same to me. Any input is greatly appreciated :)
mike john
  • 83
  • 4
6
votes
2 answers

DDD Factory Entity Value Object

I have been increasingly adopting DDD / Onion Architecture in my current project. One of the many things I am still unclear about is how much encapsulation should there be. Easier explained with a concrete example. Example namespace…
M Afifi
  • 4,645
  • 2
  • 28
  • 48
5
votes
0 answers

Where I should put Excel/PDF generator class or function in Onion/Clean Architecture?

I want to add Excel and PDF generator in my new Solution in dotnet core 6. I following this…
yozawiratama
  • 4,209
  • 12
  • 58
  • 106
5
votes
2 answers

throwing exception vs returning operation result object in Onion architecture

I have a project implemented by Onion Architecture, and it is similar to Ordering. I need to handle validation errors in the all layers. As far as I know, there are generally two following approaches to do handle the errors: 1- Throwing exception 2-…
Ali Soltani
  • 9,589
  • 5
  • 30
  • 55
5
votes
1 answer

Why expose service instead of repository in Onion Architecture?

I'm digging in on how to structure projects and so I stumbled upon Onion Architecture. As far as I understand it, it's more of a domain-centered-focus architecture instead of a database-driven type. I'm looking for some github projects to study and…
Boy Pasmo
  • 8,021
  • 13
  • 42
  • 67
5
votes
1 answer

MVC Onion architecture, some questions

I'm creating a project with Asp.net MVC 5, Web Api 2, and Entity Framework. I'm designing it with an Onion architecture, so I have a DAL, Service and UI layers. My DAL layer contains a UnitOfWork and Repositories, my Service layer contains services…
5
votes
1 answer

Is It Possible to Implement Onion Architecture and DI with WebAPI on OWIN?

I'm attempting to follow an Onion Architecture for a WebAPI services hosted on OWIN/Katana. I have a solution structure like this: DependencyResolution: contains OWIN Startup class and IoC setup WebApi: Web API controllers Infrastructure:…
Bullines
  • 5,626
  • 6
  • 53
  • 93
5
votes
0 answers

Handling Domain Events asynchronously

I have implemented domain events as prescribed in Udi Dahan's Domain Events - Salvation article. As far as I understand, domain events can be run asynchronously to the thread from which it was raised (typically from a domain model or service). …
1 2
3
19 20