This repository demonstrates how to implement modern software architecture and design patterns using .NET Framework 4.7, WinForms, and WPF. It serves as a proof of concept that legacy frameworks can support clean, maintainable, and extensible code design.
The project showcases various modern software development practices and patterns:
- Multiple UI Frameworks: Both WinForms and WPF implementations sharing the same business logic
- MVVM Pattern: Clean separation of concerns with ViewModels shared between UI frameworks
- Dependency Injection: Using Autofac for flexible configuration and loose coupling
- Multiple Storage Options: Configurable storage mechanisms (JSON/XML)
- Advanced Logging: Cross-cutting logging implementation using interceptors
- Clean Architecture: Interface-based design with proper separation of concerns
graph TB
subgraph UI["UI Layer"]
WPF["WPFUI<br/>(ReactiveUI)"]
WF["WinFormUI<br/>(Modern Practices)"]
end
subgraph BL["Business Logic"]
VM["ViewModels"]
EP["Employee Processors"]
LI["Logger Interceptor"]
end
subgraph Data["Data Layer"]
JS["JSON Storage"]
XS["XML Storage"]
M["Models"]
end
WPF --> VM
WF --> VM
VM --> EP
EP --> M
M --> JS
M --> XS
EP -.-> LI
M -.-> LI
style UI fill:#f9f,stroke:#333,stroke-width:2px
style BL fill:#bbf,stroke:#333,stroke-width:2px
style Data fill:#bfb,stroke:#333,stroke-width:2px
graph LR
AC["Autofac Container"] --> |Configures| UI["UI Components"]
AC --> |Configures| BP["Business Processors"]
AC --> |Configures| ST["Storage"]
AC --> |Configures| LOG["Logging"]
subgraph Configuration
CF["Code Config<br/>(WPF)"]
JF["JSON Config<br/>(WinForms)"]
end
CF --> AC
JF --> AC
style AC fill:#f96,stroke:#333,stroke-width:2px
style Configuration fill:#ff9,stroke:#333,stroke-width:2px
graph LR
subgraph WPF["WPF Application"]
WV["WPF View"] --> |Bindings| VM["ViewModel"]
end
subgraph WinForms["WinForms Application"]
WFV["WinForms View"] --> |Bindings| VM
end
VM --> |Updates| M["Model"]
M --> |Notifies| VM
style WPF fill:#f9f,stroke:#333,stroke-width:2px
style WinForms fill:#bbf,stroke:#333,stroke-width:2px
style VM fill:#bfb,stroke:#333,stroke-width:2px
- DRYDemoLibrary: Core business logic and interfaces
- ModelsLib: Data models and storage implementations
- WPFUI: WPF implementation using ReactiveUI
- WinFormUI: WinForms implementation with modern practices
- DryDemoLibraryTest: Unit tests for the business logic
- Configure application behavior through code or JSON
- Swap between different storage mechanisms
- Choose between multiple UI implementations
- Configure logging behavior
- Logging through interceptors using Autofac.Extras.DynamicProxy
- Multiple logger implementations (Console, File)
- Configurable logging behavior per component
- JSON file storage
- XML file storage
- Easily extendable for new storage types
- WPF with ReactiveUI
- WinForms with modern practices
- Shared ViewModels between frameworks
- Clean separation of UI and business logic
- Clone the repository
- Open the solution in Visual Studio
- Build the solution
- Choose either the WinForms or WPF project as your startup project
- Run the application
The application can be configured through:
- Code-based configuration in the respective UI projects
- JSON configuration file for the WinForms application
- XML configuration options available
- SOLID Principles: The project strictly follows SOLID design principles
- DRY (Don't Repeat Yourself): Common logic is shared across implementations
- Interface-Based Design: All major components are interface-based for flexibility
- Cross-Cutting Concerns: Handled elegantly through interceptors
- Clean Architecture: Proper separation of concerns and dependencies
- Convert Views to reusable controls
- Implement master-detail content views
- Modern UI design updates for both frameworks
- Additional UI framework implementations
- Continuous documentation improvements
Feel free to contribute to this project by:
- Submitting bug reports
- Proposing new features
- Creating pull requests
- Improving documentation
Special thanks to Tim Corey for the initial inspiration through his DRY demo video.
This project is open source and available under the MIT License.