Address Book Onion architecture with ASP.NET Core


Onion Architecture

AddressBook API solution is built on Onion Architecture with all essential feature using .NET Core!
Trello board for user stories can be found here: https://trello.com/b/pHCmBh1R/addressbook

Table of Contents

Onion Architecture

Onion Architecture was introduced by Jeffrey Palermo to provide a better way to build applications in perspective of better testability, maintainability, and dependability on the infrastructures like databases and services

Onion, Clean or Hexagonal architecture: it's all the same. Which is built on Domain-Driven Desgin approach.

Domain in center and building layer top of it. You can call it as Domain-centric Architecture too.

Reference

About The Project

AddressBook API solution is built on Onion Architecture with all essential feature using .NET Core.

image

Getting Started

Step 1: Clone the solution

Step 2: Restore nuget packages and install packages for the client project

Step 3: Create Database (Sample is for Microsoft SQL Server)

Plese run the script file "InitialScript" under documents\scripts to create your database

Step 4: Build and run application

Swagger UI

image

Features available in this project

This addressbook api contains following features.

  • Application is implemented on Onion architecture
  • API
  • Entityframework Core
  • Expection handling
  • Automapper
  • Unit testing via NUnit & Nsubstitute for mocking
  • Integration testing via NUnit
  • Versioning
  • Swagger
  • CQRS Pattern

Project description

we can see that all the Layers are dependent only on the Core Layers

Domain layer

Domain Layers (Core layer) is implemented in center and never depends on any other layer. Therefore, what we do is that we create interfaces to Persistence layer and these interfaces get implemented in the external layers. This is also known and DIP or Dependency Inversion Principle

Persistence layer

In Persistence layer where we implement reposistory design pattern. In our project, we have implement Entityframework which already implements a repository design pattern.

Service layer

Service layer (or also called as Application layer) where we can implement business logic. For OLAP/OLTP process, we can implement CQRS design pattern. In our project, we have implemented CQRS design pattern on top of Mediator design pattern via MediatR libraries

Presentation Layer

This is an angular app found under client folder.

License Used

MIT License

See the contents of the LICENSE file for details

Contact

Having any issues or troubles getting started? Drop a mail to zuluchs@gmail.com. Always happy to help.

I do coding for fun during leisure time, but I have to pay the bills, so I also work for money :P