6.5 KiB
6.5 KiB
Comprehensive Plan: DataPRO Project Enhancement & Modernization
Architecture Overview
Current Technology Stack
- Primary Framework: .NET Framework 4.5.2-4.8 (legacy, not cross-platform)
- UI Framework: WPF with Prism 7.x + Unity DI container
- Database: SQL Server LocalDB (User Instances)
- Architecture Pattern: Modular composite application with MVVM pattern
- Languages: C# (predominantly), some VB.NET interop
Project Structure
├── Common/ (19+ libraries - reusable components)
├── DataPRO/ (main application + modules)
├── DTS Viewer/ (secondary viewer application)
└── Installer/ (InstallShield-based deployment)
Key Components
- DataPRO: Main application (WinForms/WPF hybrid, x86/x64 builds)
- DataPRO.Core: Plugin architecture, settings management, service management
- IService: Hardware service layer (~200 classes managing SLICE/TDAS/Ribeye hardware)
- DbAPI: Database access layer (new SDK-style project)
- DatabaseMigrator: Version migration tool for LocalDB user instances
- 473 SQL files: Database schema changes, stored procedures
Improvement Plan
Phase 1: Foundation Stabilization (Weeks 1-4)
Priority: HIGH
1.1 Test Infrastructure
- Current: NUnit 3.12.0, limited test coverage
- Actions:
- Expand unit test coverage to ~70%+ (prioritize core logic: sensor math, channel processing)
- Add integration tests for database operations
- Implement CI/CD pipeline (Azure DevOps or GitHub Actions)
- Add code quality tools: SonarQube/AltCover for coverage, StyleCop for consistency
1.2 Dependency Management
- Current: Mixed packages.config + project references
- Actions:
- Migrate all
packages.configtoPackageReferenceformat - Consolidate duplicate libraries (Newtonsoft.Json versions, Prism libraries)
- Audit third-party dependencies for security vulnerabilities
- Migrate all
1.3 Configuration Modernization
- Current: 699-line app.config with hardcoded secrets
- Actions:
- Extract sensitive values (passwords) to encrypted configuration or secure vault
- Implement configuration validation
- Migrate from legacy
<applicationSettings>to strongly-typed Options pattern
Phase 2: Architecture Modernization (Weeks 5-12)
Priority: MEDIUM
2.1 .NET Target Framework Upgrade
- Current: .NET Framework 4.5.2/4.8 (Windows-only)
- Target: .NET 8.0 (LTS, cross-platform, performance gains)
- Approach: Gradual migration strategy
- Upgrade to .NET 6.0 first (easier migration path)
- Update all projects to SDK-style
.csprojformat - Refactor WinForms components to WPF or modern equivalent
Challenges:
- ComponentOne WPF controls (need compatibility check)
- InstallShield installer (may need replacement with MSIX or WiX)
2.2 Dependency Injection Container
- Current: Unity Container (deprecated, no active development)
- Target: Microsoft.Extensions.DependencyInjection (standard .NET DI)
- Benefits:
- Active Microsoft support
- Better integration with modern .NET
- Cleaner API
2.3 Database Access Layer
- Current: Legacy DbAPI with 473 SQL scripts
- Actions:
- Introduce Entity Framework Core or Dapper for type-safe database access
- Implement database version migrations with FluentMigrator or EF Core Migrations
- Add database connection pooling optimization
2.4 Module Architecture
- Current: Prism DirectoryModuleCatalog (file-based discovery)
- Actions:
- Add assembly scanning with dependency constraints
- Implement module versioning
- Add module health checks and lifecycle management
Phase 3: Performance Optimization (Weeks 13-16)
Priority: HIGH
3.1 Memory Management
- Current: Applications can consume large memory (gcAllowVeryLargeObjects enabled)
- Actions:
- Profile memory usage (dotMemory or Visual Studio Diagnostic Tools)
- Implement lazy loading for large data structures
- Add object pooling for frequently created objects
3.2 Database Query Optimization
- Actions:
- Add database query profiling
- Implement caching layer for frequently accessed data
- Optimize stored procedures (30+ queries have been cached)
3.3 Real-time Processing
- Current: polling-based real-time updates (4ms intervals)
- Actions:
- Evaluate reactive extensions (Rx) for event-driven updates
- Consider background services with background workers
- Optimize UDP multicast listening
Phase 4: Developer Experience (Weeks 17-20)
Priority: MEDIUM
4.1 Build & Deployment
- Actions:
- Implement automated build pipeline
- Create hotfix deployment strategy
- Add application self-update mechanism
4.2 Documentation
- Actions:
- Generate API documentation with DocFX
- Create architecture decision records (ADRs)
- Add code comments for public APIs
4.3 Monitoring & Telemetry
- Actions:
- Implement structured logging (Serilog or Microsoft.Extensions.Logging)
- Add application health monitoring
- Set up error reporting (Sentry or Application Insights)
Recommended Starting Points
Immediate Action Items (Next 2 Weeks):
-
Set up CI/CD pipeline
- GitHub Actions/Azure DevOps build
- Automated test execution on pull requests
-
Add code quality gates
- Configure SonarQube or similar
- Enforce coding standards
-
Create feature branch strategy
- trunk-based development or GitFlow
- Define release cadence
-
Start migration to SDK-style projects
- Convert one non-critical module first
- Validate build process
-
Performance baseline
- Measure startup time, memory usage, database query times
- Document current metrics
Risk Assessment
| Risk | Impact | Mitigation |
|---|---|---|
| .NET Framework → .NET 6+ breaking changes | HIGH | Phase-by-phase migration, extensive testing |
| Database schema migration issues | HIGH | Backup strategies, rollback procedures |
| Dependency conflicts | MEDIUM | Gradual package updates, dependency analysis |
| Installer changes | MEDIUM | Test thoroughly with different OS versions |
Next Steps
Before proceeding, please confirm:
- Database migration strategy (keep LocalDB, migrate to SQLite/SQL Server Express?)
- UI framework direction (modernize WPF, migrate to MAUI?)
- Deployment Targets (on-premises only, or cloud-hosted?)
- Third-party dependencies (bound to ComponentOne, open to alternatives?)
- Testing priorities (which modules need test coverage first?)