emacsway / onion-architecture-dotnet-6

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Thanks to Clear Measure for sponsoring this sample and episode of Programming with Palermo.

Code Sample

.NET

.NET 6 using Onion Architecture

This is a sample of .NET 6 implemented with Onion Architecture. This is how to get started with the core of the onion architecture. We start with a clean class library, unit tests, and a build. It's important to get this foundation correct before proceeding. We want our build working before adding any domain model or interfaces. We then add an interface to a database with a "DataAccess" project. Then we add an interface to a user, with the Blazor UI project. We add UnitTests and IntegrationTests, wire it up to both GitHub Actions as well as Azure Pipelines to show how both work easily for continuous integration. We add a private build as well as CI build build scripts. Then we configure dependency management with an Inversion of Control container and refactor the project structure so that there is one project as an entry point while keeping all interfaces independent. The Blazor webassembly application has no access to the web services project (UI.Api). The Api project that contains the web services has no access to DataAccess. Additionally, the UI.Server project is stripped of all responsibility except to start the application and configure dependencies.

Onion Architecture solution structure

Application

Thanks to Clear Measure for sponsoring this sample and episode of Programming with Palermo.

About

License:MIT License


Languages

Language:C# 62.3%Language:HTML 15.0%Language:PowerShell 11.9%Language:CSS 10.1%Language:Batchfile 0.4%Language:TSQL 0.3%