A simple yet robust implementation of clean architecture in .NET. This project demonstrates my approach to building apps from the ground up, incorporating best practices I've developed over time.
The project is structured using the clean architecture pattern. This pattern is designed to separate concerns and make the codebase more maintainable and scalable.
- 🗁 files - contains solution level files like
.gitignore,license,readme.md, etc. - 🗁 src - contains projects which are part of the solution.
- 🗁 Application - application services and feature logic.
- 🗁 Domain - domain entities.
- 🗁 Infrastructure - contains implementation of infrastructure services like database, email, etc.
- 🗁 Web - UI project, basically representation layer.
- 🗁 tests - TBD
- 🗁 scripts -
powershellscripts to automate every-day developer tasks.
- ⚙️ Prefer creating an
appsettings.development.jsonto store configuration in development environment. File is excluded from version control. This approach is simpler than using user secrets and absolutely safe.
- 📃
scriptsfolder containspowershellscripts to automate every-day developer tasks.
.\get-paths.ps1
Context : ApplicationDbContext
DataProject : C:\Source\blazor-clean-arch\src\BCA.Infrastructure\BCA.Infrastructure.csproj
Migrations : C:\Source\blazor-clean-arch\src\BCA.Infrastructure\Database\Migrations
Root : C:\Source\blazor-clean-arch
StartupProject : C:\Source\blazor-clean-arch\src\BCA.Web\BCA.Web.csproj.\add-migration.ps1 "TodoLists"
Build started...
Build succeeded.
Done. To undo this action, use 'ef migrations remove'- 🚧 TBD
The project uses Entity Framework Core as the ORM.
- ☑️
Code Firstapproach. - ☑️
Migrationsare applied automatically on application start. - ☑️
Soft deleteimplemented usingDeletedAtcolumn. Obviously not all entities need to beISoftDelete'able, so there is a logic to distinct them. - ☑️
Change trackingturned off by default. In those rare cases when I need to retrieve an entity, change it and save back - I will use.AsTracking().
- ✅
FluentValidationis used for validation. Validation rules are incapsulated inDTOs they suppose to validate. The process itself happens inMediatR's pipeline.
- 🚧 TBD
- 🚧 TBD
- 🚧 TBD
- 🚧 TBD
- 🚧 TBD
