Connect with Me

LinkedIn

🧱 WPF Clean Architecture - Master Detail App

This project is a modern WPF desktop application using Clean Architecture principles. It showcases a basic Customer–Order master-detail interface with proper layering, validation, and MVVM patterns.


✨ Features

  • βœ… 4-Tier Clean Architecture:

    • Domain: Entities, Interfaces
    • Application: DTOs, Services, Validators
    • Infrastructure: EF Core (SQLite), Mappings, DbContext
    • UI: WPF (MVVM), CommunityToolkit.Mvvm
  • 🧩 Master-Detail pattern: Customers and their Orders

  • πŸ“¦ SQLite with DbContextFactory (safe for DI + design-time)

  • πŸ§ͺ FluentValidation for input rules

  • πŸ’‘ RelayCommand + ObservableObject via CommunityToolkit

  • πŸͺŸ Dialogs for Add/Edit Customers


πŸ› οΈ Tech Stack

  • .NET 9.0
  • WPF (.NET Desktop)
  • Entity Framework Core
  • SQLite
  • CommunityToolkit.Mvvm
  • FluentValidation

πŸš€ Getting Started

1. Clone the repo

git clone https://github.com/your-username/WpfAppCleanArchitecture.git
cd WpfAppCleanArchitecture
---
2. Run EF Core migration (once)
---
bash

dotnet ef migrations add InitialCreate -s WpfAppCleanArchitecture
dotnet ef database update -s WpfAppCleanArchitecture
If dotnet ef is not recognized, run: dotnet tool install --global dotnet-ef

---
3. Run the app
---
dotnet run --project WpfAppCleanArchitecture
πŸ“‚ Project Structure

WpfAppCleanArchitecture/
β”‚
β”œβ”€β”€ Domain/                  # Entities, Interfaces
β”œβ”€β”€ Application/             # DTOs, Services, Validators
β”œβ”€β”€ Infrastructure/          # EF Core, SQLite, Mappings
β”œβ”€β”€ UI/                      # WPF views, ViewModels
β”‚   β”œβ”€β”€ Views/
β”‚   └── ViewModels/
β”œβ”€β”€ Dialogs/                 # WPF modal dialogs
β”œβ”€β”€ appsettings.json         # Connection string
└── Program.cs               # Host builder, DI setup
✍️ Example: Add Customer
Opens a dialog with CustomerDialogViewModel

Validates Name field (required, length)

Saves to database and updates ObservableCollection