Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Vertical Slice Architecture - .NET 9 Solution

This project demonstrates a Vertical Slice Architecture using .NET 9, with proper separation of concerns, clean architecture principles, and comprehensive testing strategies.

Architecture Overview

This solution implements Clean Architecture with Vertical Slice Architecture patterns, organized into multiple projects for better maintainability, scalability, and team collaboration.

Key Principles

  1. Clean Architecture: Dependency inversion with clear layer boundaries
  2. Vertical Slice Architecture: Feature-based organization within layers
  3. CQRS Pattern: Separation of read and write operations
  4. Domain-Driven Design: Rich domain models with business logic
  5. SOLID Principles: Single responsibility, dependency inversion, etc.

Solution Structure

Architecture/
├── VerticalSlices.Api/          #  API Layer (Presentation)
│   ├── Controllers/                          # HTTP endpoints
│   ├── Program.cs                            # Application configuration
│   └── appsettings.json                      # Configuration
├── VerticalSlices.Core/                      # Domain Layer
│   ├── Domain/
│   │   ├── Entities/                         # Domain entities
│   │   ├── Repositories/                     # Repository interfaces
│   │   ├── Events/                           # Domain events
│   │   └── Exceptions/                       # Domain exceptions
├── VerticalSlices.Application/               # Application Layer
│   ├── Features/
│   │   ├── Tasks/                            # Tasks feature
│   │   │   ├── Commands/                     # Write operations
│   │   │   ├── Queries/                      # Read operations
│   │   │   ├── DTOs/                         # Data transfer objects
│   │   │   ├── Mapping/                      # AutoMapper profiles
│   │   │   └── Validation/                   # FluentValidation rules
│   │   └── Users/                            # Users feature
├── VerticalSlices.Infrastructure/            # Infrastructure Layer
│   ├── Data/                                 # Entity Framework
│   └── Repositories/                         # Repository implementations
├── VerticalSlices.Shared/                    # Shared Layer
│   └── Common/                               # Common utilities
├── VerticalSlices.Tests.Unit/                # Unit Tests
└── VerticalSlices.Tests.Integration/         # Integration Tests

Architecture Layers

1. Core (Domain Layer)

  • Purpose: Contains business logic and domain entities
  • Dependencies: None (innermost layer)
  • Contains: Entities, Repository interfaces, Domain events, Exceptions

2. Application Layer

  • Purpose: Orchestrates business operations
  • Dependencies: Core
  • Contains: CQRS handlers, DTOs, Validation, Mapping

3. Infrastructure Layer

  • Purpose: Implements external concerns (database, external APIs)
  • Dependencies: Core, Application
  • Contains: Repository implementations, DbContext, External services

4. API Layer (Presentation)

  • Purpose: Handles HTTP requests and responses
  • Dependencies: All other layers
  • Contains: Controllers, Middleware, Configuration

Getting Started

Prerequisites

  • .NET 9 SDK
  • SQL Server LocalDB (or SQL Server Express)
  • Visual Studio 2022 or Rider or VS Code

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages