SlideShare a Scribd company logo
Onion
Architecture
Overview
Shcherbyna A.
Introduction
The Onion Architecture term was coined by Jeffrey Palermo in 2008. This architecture
provides a better way to build applications for better testability, maintainability, and
dependability on the infrastructures like databases and services.
More info on https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/
2
Key tenets of Onion Architecture
› The application is built around an independent object
model
› Inner layers define interfaces. Outer layers implement
interfaces
› Direction of coupling is toward the center
› All application core code can be compiled and run
separate from infrastructure
3
Advantages of Onion Architecture
› It provides better maintainability as all the codes depend on
layers or the center.
› It provides better testability as the unit test can be created for
separate layers without an effect of other modules of the
application.
› It develops a loosely coupled application as the outer layer of the
application always communicates with inner layer via interfaces.
› Any concrete implantation would be provided to the application
at run time
› Domain entities are core and center part. It can have access to
both database and UI layers.
› The internal layers never depend on external layer. The code that
may have changed should be part of an external layer.
4
ONION CORE LAYERS
Domain
Service
ONION NOT CORE LAYERS
Infrastructure
User Interface
Tests
5
Onion Architecture Dependencies
6
Place DOMAIN LAYER SCREEN
DOMAIN LAYEAR
It is the center part of the
architecture. It holds all
application domain objects. If
an application is developed
with ORM entity framework
then this layer holds POCO
classes (Code First) or Edmx
(Database First) with entities.
7
Place Repository LAYER SCREEN
SERVICE LAYEAR
The layer holds interfaces
which are used to
communicate between the UI
layer and domain layer. It holds
business logic for an entity so
it’s called business logic layer
as well.
8
INFRASTRUCTURE LAYEAR
It implements not business
logic requirements. It can
contains Data access
realization (PostgreSQL, Json).
Remote client request
handlers.
9
Place Repository LAYER SCREEN
USER INTERFACE LAYEAR
Is everything designed into an
information device with which
a person may interact. This can
include
display screens, keyboards,
a mouse and the appearance
of a desktop. It is also the way
through which a user interacts
with an application or
a website.
10
TESTS LAYEAR
Contains different types of
tests (Unit, Integration,
Performance).
11
Onion Architecture
Resources:
› https://blog.thedigitalgroup.com/understanding-onion-architecture
› https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/
› https://social.technet.microsoft.com/wiki/contents/articles/36655.onion-architecture-in-
asp-net-core-mvc.aspx
You can download application sample:
https://github.com/khdevnet/onion-architecture
12

More Related Content

Similar to Onion architecture overview

Mobile iOS Application Architectures
Mobile iOS Application ArchitecturesMobile iOS Application Architectures
Mobile iOS Application Architectures
Arpit Kulsreshtha
 
Object and component based middleware for distributed system development
Object and component based middleware for distributed system developmentObject and component based middleware for distributed system development
Object and component based middleware for distributed system development
ektabhalwara
 
Report on mall automation
Report on mall automationReport on mall automation
Report on mall automation
Sonu Patel
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
Knoldus Inc.
 
Community platform for job seekers | web application for job seekers | case s...
Community platform for job seekers | web application for job seekers | case s...Community platform for job seekers | web application for job seekers | case s...
Community platform for job seekers | web application for job seekers | case s...
Mike Taylor
 
All the amazing features of asp.net core
All the amazing features of asp.net coreAll the amazing features of asp.net core
All the amazing features of asp.net core
GrayCell Technologies
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
suneel singh
 
Information on Cloud-native Applications
Information on Cloud-native ApplicationsInformation on Cloud-native Applications
Information on Cloud-native Applications
HTS Hosting
 
Documentation
DocumentationDocumentation
Documentation
Rajesh Seendripu
 
1. gen1 evolution and architecture of t24-r10.01
1. gen1 evolution and architecture of t24-r10.011. gen1 evolution and architecture of t24-r10.01
1. gen1 evolution and architecture of t24-r10.01
Emmanuel Boadu
 
Online lg prodect
Online lg prodectOnline lg prodect
Online lg prodect
Yesu Raj
 
The java enterprise edition (Servlet Basic)
The java enterprise edition (Servlet Basic)The java enterprise edition (Servlet Basic)
The java enterprise edition (Servlet Basic)
Atul Saurabh
 
ios basics
ios basicsios basics
ios basics
Muthu Sabarinathan
 
Open network operating system (onos)
Open network operating system (onos)Open network operating system (onos)
Open network operating system (onos)
Ameer Sameer
 
The Twelve Factor Apps
The Twelve Factor AppsThe Twelve Factor Apps
The Twelve Factor Apps
tomi vanek
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
ABDEL RAHMAN KARIM
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
suraj pandey
 
spring
springspring
spring
Suman Behara
 
Best Full Stack .NET Core Classroom & Online training - Naresh IT
Best Full Stack .NET Core Classroom & Online training - Naresh ITBest Full Stack .NET Core Classroom & Online training - Naresh IT
Best Full Stack .NET Core Classroom & Online training - Naresh IT
manoharjgpsolutions
 
11.universal mobile application development (umad) on home automation
11.universal mobile application development (umad) on home automation11.universal mobile application development (umad) on home automation
11.universal mobile application development (umad) on home automation
Alexander Decker
 

Similar to Onion architecture overview (20)

Mobile iOS Application Architectures
Mobile iOS Application ArchitecturesMobile iOS Application Architectures
Mobile iOS Application Architectures
 
Object and component based middleware for distributed system development
Object and component based middleware for distributed system developmentObject and component based middleware for distributed system development
Object and component based middleware for distributed system development
 
Report on mall automation
Report on mall automationReport on mall automation
Report on mall automation
 
Getting started with dotnet core Web APIs
Getting started with dotnet core Web APIsGetting started with dotnet core Web APIs
Getting started with dotnet core Web APIs
 
Community platform for job seekers | web application for job seekers | case s...
Community platform for job seekers | web application for job seekers | case s...Community platform for job seekers | web application for job seekers | case s...
Community platform for job seekers | web application for job seekers | case s...
 
All the amazing features of asp.net core
All the amazing features of asp.net coreAll the amazing features of asp.net core
All the amazing features of asp.net core
 
Project report for final year project
Project report for final year projectProject report for final year project
Project report for final year project
 
Information on Cloud-native Applications
Information on Cloud-native ApplicationsInformation on Cloud-native Applications
Information on Cloud-native Applications
 
Documentation
DocumentationDocumentation
Documentation
 
1. gen1 evolution and architecture of t24-r10.01
1. gen1 evolution and architecture of t24-r10.011. gen1 evolution and architecture of t24-r10.01
1. gen1 evolution and architecture of t24-r10.01
 
Online lg prodect
Online lg prodectOnline lg prodect
Online lg prodect
 
The java enterprise edition (Servlet Basic)
The java enterprise edition (Servlet Basic)The java enterprise edition (Servlet Basic)
The java enterprise edition (Servlet Basic)
 
ios basics
ios basicsios basics
ios basics
 
Open network operating system (onos)
Open network operating system (onos)Open network operating system (onos)
Open network operating system (onos)
 
The Twelve Factor Apps
The Twelve Factor AppsThe Twelve Factor Apps
The Twelve Factor Apps
 
Over view of software artitecture
Over view of software artitectureOver view of software artitecture
Over view of software artitecture
 
Introduction to vb.net
Introduction to vb.netIntroduction to vb.net
Introduction to vb.net
 
spring
springspring
spring
 
Best Full Stack .NET Core Classroom & Online training - Naresh IT
Best Full Stack .NET Core Classroom & Online training - Naresh ITBest Full Stack .NET Core Classroom & Online training - Naresh IT
Best Full Stack .NET Core Classroom & Online training - Naresh IT
 
11.universal mobile application development (umad) on home automation
11.universal mobile application development (umad) on home automation11.universal mobile application development (umad) on home automation
11.universal mobile application development (umad) on home automation
 

Recently uploaded

The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
Katrina Pritchard
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
NgcHiNguyn25
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
paigestewart1632
 

Recently uploaded (20)

The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
BBR 2024 Summer Sessions Interview Training
BBR  2024 Summer Sessions Interview TrainingBBR  2024 Summer Sessions Interview Training
BBR 2024 Summer Sessions Interview Training
 
Life upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for studentLife upper-Intermediate B2 Workbook for student
Life upper-Intermediate B2 Workbook for student
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
Cognitive Development Adolescence Psychology
Cognitive Development Adolescence PsychologyCognitive Development Adolescence Psychology
Cognitive Development Adolescence Psychology
 

Onion architecture overview

  • 2. Introduction The Onion Architecture term was coined by Jeffrey Palermo in 2008. This architecture provides a better way to build applications for better testability, maintainability, and dependability on the infrastructures like databases and services. More info on https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/ 2
  • 3. Key tenets of Onion Architecture › The application is built around an independent object model › Inner layers define interfaces. Outer layers implement interfaces › Direction of coupling is toward the center › All application core code can be compiled and run separate from infrastructure 3
  • 4. Advantages of Onion Architecture › It provides better maintainability as all the codes depend on layers or the center. › It provides better testability as the unit test can be created for separate layers without an effect of other modules of the application. › It develops a loosely coupled application as the outer layer of the application always communicates with inner layer via interfaces. › Any concrete implantation would be provided to the application at run time › Domain entities are core and center part. It can have access to both database and UI layers. › The internal layers never depend on external layer. The code that may have changed should be part of an external layer. 4
  • 5. ONION CORE LAYERS Domain Service ONION NOT CORE LAYERS Infrastructure User Interface Tests 5
  • 7. Place DOMAIN LAYER SCREEN DOMAIN LAYEAR It is the center part of the architecture. It holds all application domain objects. If an application is developed with ORM entity framework then this layer holds POCO classes (Code First) or Edmx (Database First) with entities. 7
  • 8. Place Repository LAYER SCREEN SERVICE LAYEAR The layer holds interfaces which are used to communicate between the UI layer and domain layer. It holds business logic for an entity so it’s called business logic layer as well. 8
  • 9. INFRASTRUCTURE LAYEAR It implements not business logic requirements. It can contains Data access realization (PostgreSQL, Json). Remote client request handlers. 9
  • 10. Place Repository LAYER SCREEN USER INTERFACE LAYEAR Is everything designed into an information device with which a person may interact. This can include display screens, keyboards, a mouse and the appearance of a desktop. It is also the way through which a user interacts with an application or a website. 10
  • 11. TESTS LAYEAR Contains different types of tests (Unit, Integration, Performance). 11
  • 12. Onion Architecture Resources: › https://blog.thedigitalgroup.com/understanding-onion-architecture › https://jeffreypalermo.com/2008/07/the-onion-architecture-part-1/ › https://social.technet.microsoft.com/wiki/contents/articles/36655.onion-architecture-in- asp-net-core-mvc.aspx You can download application sample: https://github.com/khdevnet/onion-architecture 12