WPF Inventory Management SystemΒΆ
π Project Path: csharp/desktop-apps/wpf/WpfInventoryApp/
Technologies: C# β’ WPF β’ SQLite
WPF Inventory Management SystemΒΆ
π Project Path:
csharp/desktop-apps/wpf/WpfInventoryApp/π GitHub Repository: https://github.com/AmalieShi/amalie_projects
A comprehensive WPF desktop application built with enterprise-grade MVVM architecture for inventory management.
ArchitectureΒΆ
Design PatternsΒΆ
MVVM (Model-View-ViewModel): Strict separation of concerns
Repository Pattern: Decoupled data access layer from business logic
Dependency Injection: Microsoft.Extensions.DependencyInjection
Command Pattern: RelayCommand and AsyncRelayCommand implementations
Technology StackΒΆ
.NET 8: Modern C# with latest features
WPF: Rich desktop user interface
Entity Framework Core: ORM with SQLite database
xUnit + FluentAssertions: Comprehensive unit testing
Microsoft Extensions: Configuration, Logging, DI
Database SchemaΒΆ
Products TableΒΆ
CREATE TABLE Products (
Id INTEGER PRIMARY KEY AUTOINCREMENT,
Name TEXT(100) NOT NULL,
SKU TEXT(50) NOT NULL UNIQUE,
Quantity INTEGER NOT NULL DEFAULT 0,
Price DECIMAL(18,2) NOT NULL,
CreatedAt DATETIME DEFAULT (datetime('now')),
UpdatedAt DATETIME DEFAULT (datetime('now'))
);
FeaturesΒΆ
CRUD OperationsΒΆ
β Create: Add new products with validation
β Read: View all products in sortable DataGrid
β Update: Edit existing products with form validation
β Delete: Remove products with confirmation dialog
Data ManagementΒΆ
SQLite Database: Lightweight, file-based storage
Entity Framework Core: Code-first migrations
Unique SKU Validation: Prevents duplicate product codes
Automatic Timestamps: CreatedAt and UpdatedAt tracking
User ExperienceΒΆ
Responsive UI: Modern WPF styling with visual feedback
Real-time Validation: Input validation with error messages
Status Updates: Progress indicators and status messages
Keyboard Navigation: Full keyboard accessibility
ConfigurationΒΆ
Environment VariablesΒΆ
# Database connection string (optional)
INVENTORY_DB_CONNECTION="Data Source=custom_inventory.db;Cache=Shared"
appsettings.jsonΒΆ
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=inventory.db;Cache=Shared"
},
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.EntityFrameworkCore": "Warning"
}
}
}
Quality AssuranceΒΆ
Unit Testing CoverageΒΆ
β Repository CRUD Operations: All database operations tested
β Data Validation: Input validation and business rules
β Error Handling: Exception scenarios and edge cases
β Memory Management: Disposal and leak prevention
β Connection Handling: Database connection lifecycle
Test CategoriesΒΆ
Functional Tests: CRUD operations validation
Integration Tests: Database interaction testing
Performance Tests: Memory leak detection
Boundary Tests: Edge case handling
Development SetupΒΆ
PrerequisitesΒΆ
.NET 8 SDK
Visual Studio 2022 or VS Code
SQLite (embedded)
InstallationΒΆ
# Clone repository
git clone https://github.com/AmalieShi/amalie_projects.git
cd amalie_projects/csharp/desktop-apps/wpf/WpfInventoryApp
# Restore dependencies
dotnet restore
# Build solution
dotnet build
# Run application
dotnet run
Running TestsΒΆ
# Run all tests
dotnet test
# Run with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run specific test category
dotnet test --filter "Category=Repository"
π Project StructureΒΆ
WpfInventoryApp/
βββ Commands/ # MVVM Command implementations
β βββ RelayCommand.cs
β βββ AsyncRelayCommand.cs
βββ Data/ # Entity Framework DbContext
β βββ InventoryDbContext.cs
βββ Models/ # Data models
β βββ Product.cs
βββ Repositories/ # Repository pattern implementation
β βββ IProductRepository.cs
β βββ ProductRepository.cs
βββ ViewModels/ # MVVM ViewModels
β βββ ViewModelBase.cs
β βββ ProductViewModel.cs
β βββ MainViewModel.cs
βββ Views/ # WPF Views
β βββ MainWindow.xaml
β βββ MainWindow.xaml.cs
βββ App.xaml # Application resources
βββ App.xaml.cs # Application startup
βββ appsettings.json # Configuration
WpfInventoryApp.Tests/
βββ Repositories/ # Unit tests
βββ ProductRepositoryTests.cs
Security & Best PracticesΒΆ
Database SecurityΒΆ
Parameterized Queries: SQL injection prevention
Connection String Protection: Environment variable support
Data Validation: Input sanitization and validation
Memory ManagementΒΆ
IDisposable Implementation: Proper resource cleanup
DbContext Scoping: Dependency injection lifecycle management
Memory Leak Prevention: Verified through unit tests
Code QualityΒΆ
SOLID Principles: Clean architecture implementation
Separation of Concerns: MVVM pattern enforcement
Error Handling: Comprehensive exception management
Logging: Structured logging with Microsoft.Extensions.Logging
π Performance CharacteristicsΒΆ
Database: SQLite with Entity Framework Core optimization
UI Responsiveness: Async operations with progress indicators
Memory Footprint: Lightweight with proper disposal patterns
Startup Time: Fast initialization with dependency injection
ContributingΒΆ
This project follows enterprise development standards:
Fork the repository
Create feature branch (
git checkout -b feature/AmazingFeature)Write tests for new functionality
Ensure all tests pass (
dotnet test)Commit changes (
git commit -m 'Add AmazingFeature')Push to branch (
git push origin feature/AmazingFeature)Open Pull Request
LicenseΒΆ
This project is part of the Amalie Projects portfolio and is available under the Apache License.