Skip to content

feat: add early-bound entity classes for system entities (#56)#109

Merged
joshsmithxrm merged 3 commits intomainfrom
claude/review-sdk-issue-56-3sfGl
Jan 3, 2026
Merged

feat: add early-bound entity classes for system entities (#56)#109
joshsmithxrm merged 3 commits intomainfrom
claude/review-sdk-issue-56-3sfGl

Conversation

@joshsmithxrm
Copy link
Copy Markdown
Owner

Summary

  • Add PAC CLI-generated early-bound entity classes for 13 system/development entities used by PPDS CLI and Migration
  • Refactor PluginRegistrationService and PluginStepManager to use early-bound classes instead of magic strings
  • Add Generate-EarlyBoundModels.ps1 script for regenerating entities from Dataverse metadata
  • Add early-bound entity usage guidance to CLAUDE.md

Entities Generated

Category Entities
Plugin Registration PluginAssembly, PluginPackage, PluginType, SdkMessage, SdkMessageFilter, SdkMessageProcessingStep, SdkMessageProcessingStepImage
Solution/ALM Solution, SolutionComponent, AsyncOperation, ImportJob
User Management SystemUser, Publisher

Changes

  • PPDS.Dataverse: Generated entity classes in Generated/Entities/ and Generated/OptionSets/
  • PPDS.Cli: Refactored PluginRegistrationService to use early-bound classes
  • PPDS.Migration: Refactored PluginStepManager and UserMappingGenerator to use early-bound classes
  • CLAUDE.md: Added NEVER/ALWAYS rules for early-bound entity usage

Test plan

  • dotnet build -c Release --warnaserror passes
  • dotnet test passes (all unit tests)
  • Verify plugin registration commands still work with early-bound entities

Closes #56

🤖 Generated with Claude Code

claude and others added 2 commits January 3, 2026 07:12
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>
Copilot AI review requested due to automatic review settings January 3, 2026 09:07
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @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

  • Early-Bound Entity Classes: Introduced PAC CLI-generated early-bound entity classes for 13 critical system and development entities used across PPDS CLI and Migration components. This enhances type safety and developer experience by replacing 'magic strings' with strongly-typed objects.
  • Code Refactoring: Refactored PluginRegistrationService in PPDS.Cli and PluginStepManager and UserMappingGenerator in PPDS.Migration to utilize these new early-bound classes, improving code readability and maintainability.
  • Automated Model Generation: Added a new PowerShell script, Generate-EarlyBoundModels.ps1, to automate the regeneration of these early-bound entities directly from Dataverse metadata, ensuring models stay up-to-date with schema changes.
  • Documentation Update: Updated CLAUDE.md with clear guidance and 'NEVER/ALWAYS' rules for using early-bound entities, including when late-bound entities are still acceptable, and instructions for regenerating models.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PluginStepManager and UserMappingGenerator to use early-bound entity classes
  • Added .editorconfig to 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.

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>
@joshsmithxrm joshsmithxrm merged commit 06ef497 into main Jan 3, 2026
8 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in PPDS Roadmap Jan 3, 2026
@joshsmithxrm joshsmithxrm deleted the claude/review-sdk-issue-56-3sfGl branch January 3, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Add generated early-bound classes for system/development entities

4 participants