feat: add early-bound entity classes for system entities (#56)#109
feat: add early-bound entity classes for system entities (#56)#109joshsmithxrm merged 3 commits intomainfrom
Conversation
Add strongly-typed early-bound classes for 11 Dataverse system entities used by PPDS CLI and Migration, replacing late-bound magic strings with compile-time type safety and IntelliSense support. Generated entities: - PluginAssembly, PluginPackage, PluginType - SdkMessage, SdkMessageFilter - SdkMessageProcessingStep, SdkMessageProcessingStepImage - SystemUser, Solution, SolutionComponent, Publisher Also includes: - Entity-specific option set enums (IsolationMode, Stage, Mode, etc.) - Generate-EarlyBoundModels.ps1 script for regeneration via pac modelbuilder - .editorconfig rules for generated code - Refactored PluginRegistrationService, PluginStepManager, UserMappingGenerator
- Regenerate entity classes using `pac modelbuilder build` instead of hand-crafted classes for maintainability and accuracy - Add asyncoperation and importjob entities (completing issue requirements) - Fix Generate-EarlyBoundModels.ps1 to use correct PAC CLI arguments - Update code to use PAC CLI naming conventions: - Lowercase enum names (e.g., pluginassembly_isolationmode) - Default constructors with Id property initializers - Attributes1 property for image attributes - EventHandler instead of obsolete PluginTypeId - Add .editorconfig to suppress warnings for generated code - Add early-bound entity guidance to CLAUDE.md (NEVER/ALWAYS rules) - Clarify changelog rule: user-facing changes only 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @joshsmithxrm, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly improves the robustness and developer experience of the PPDS SDK by integrating early-bound entity classes for key Dataverse system entities. This change eliminates the use of error-prone 'magic strings' in several core services, replacing them with compile-time type-safe objects. The addition of an automated generation script and updated documentation ensures that these benefits are easily maintained and understood by developers. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a great step forward in improving the codebase's maintainability and type safety. The introduction of early-bound entity classes and the thorough refactoring to eliminate magic strings in PluginRegistrationService, PluginStepManager, and UserMappingGenerator are excellent changes. The new Generate-EarlyBoundModels.ps1 script is well-documented and provides a clear process for keeping the models up-to-date. The documentation updates in CLAUDE.md are also very helpful.
I've found a couple of issues in PluginRegistrationService where a deprecated field is used for querying, which could lead to incorrect behavior. My review includes suggestions to fix these. Overall, this is a high-quality contribution.
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Pull request overview
This PR adds PAC CLI-generated early-bound entity classes for 13 system entities used by PPDS CLI and Migration, replacing magic string attribute access with strongly-typed classes. The changes provide compile-time type safety and IntelliSense support for entity operations.
Key changes:
- Generated early-bound classes for plugin registration, solution/ALM, and user management entities
- Refactored
PluginStepManagerandUserMappingGeneratorto use early-bound entity classes - Added
.editorconfigto suppress documentation warnings for generated code
Reviewed changes
Copilot reviewed 8 out of 25 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
src/PPDS.Migration/UserMapping/UserMappingGenerator.cs |
Replaced magic strings with SystemUser.Fields constants for strongly-typed attribute access |
src/PPDS.Migration/Import/PluginStepManager.cs |
Refactored to use SdkMessageProcessingStep entity class and option set enums for state/status |
src/PPDS.Migration/CHANGELOG.md |
Added entry documenting the refactoring to early-bound entities |
src/PPDS.Dataverse/Generated/Entities/*.cs |
PAC CLI-generated entity classes for system entities (auto-generated code) |
src/PPDS.Dataverse/Generated/OptionSets/*.cs |
Generated option set enumerations (auto-generated code) |
src/PPDS.Dataverse/Generated/.editorconfig |
Configuration to suppress warnings for generated code |
The refactoring successfully eliminates magic strings while maintaining backwards compatibility. All generated files are properly marked as auto-generated and appropriately configured to suppress style warnings.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/PPDS.Dataverse/Generated/Entities/sdkmessageprocessingstep.cs
Dismissed
Show dismissed
Hide dismissed
src/PPDS.Dataverse/Generated/Entities/sdkmessageprocessingstepimage.cs
Dismissed
Show dismissed
Hide dismissed
Replace PluginTypeId with EventHandler field in query conditions for consistency with how we create/update steps. Microsoft deprecated PluginTypeId in favor of the polymorphic EventHandler lookup. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary
PluginRegistrationServiceandPluginStepManagerto use early-bound classes instead of magic stringsGenerate-EarlyBoundModels.ps1script for regenerating entities from Dataverse metadataEntities Generated
PluginAssembly,PluginPackage,PluginType,SdkMessage,SdkMessageFilter,SdkMessageProcessingStep,SdkMessageProcessingStepImageSolution,SolutionComponent,AsyncOperation,ImportJobSystemUser,PublisherChanges
Generated/Entities/andGenerated/OptionSets/PluginRegistrationServiceto use early-bound classesPluginStepManagerandUserMappingGeneratorto use early-bound classesTest plan
dotnet build -c Release --warnaserrorpassesdotnet testpasses (all unit tests)Closes #56
🤖 Generated with Claude Code