Forum Discussion
Introducing PASS — Project Aware Smart Scaffolder for ASP.NET Core MVC
PASS is an interesting approach to solving a common problem in ASP.NET Core MVC: regenerating scaffolded code without losing custom business logic.
Key technical recommendations
1. Separate generated and custom code: Use partial classes, separate files and clearly defined generated-code boundaries.
2. Use Roslyn carefully: Analyze syntax trees and merge compatible changes rather than blindly replacing entire files.
3. Track database changes: Compare schema versions and identify added, modified and removed database objects.
4. Protect developer changes: Generate change previews and require approval before overwriting existing code.
5. Maintain project configuration: Use `pass.json` to store naming conventions, generation rules and project preferences.
6. Add automated testing: Test regeneration against projects containing custom models, controllers and business logic.
Biggest challenge
The hardest part will be safely merging conflicting changes. Roslyn can understand C syntax, but it cannot automatically determine whether a developer's custom business logic should be replaced by newly generated code.
My recommendation: Make PASS a non-destructive, change-preview-based scaffolding tool first. Automatic merging can be introduced gradually after extensive testing.
The concept is promising, particularly for database-first EF Core projects.