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.
-
β 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
- .NET 9.0
- WPF (.NET Desktop)
- Entity Framework Core
- SQLite
- CommunityToolkit.Mvvm
- FluentValidation
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