Conversation
… introduce a requirement to handle Pre and PostImages correctly. ADD: Source Generator that creates type-safe image entity classes
…pper class instead
There was a problem hiding this comment.
Pull request overview
This PR introduces a source generator library (XrmPluginCore.SourceGenerator) that provides compile-time type safety for plugin images (PreImage/PostImage) through automated wrapper class generation. The feature enables developers to access image attributes with IntelliSense support and compile-time validation of handler method signatures.
Key changes:
- New source generator library with incremental generation support
- Method reference-based registration API (
service => service.HandleUpdate) with compile-time signature validation - Convenience methods
WithPreImage/WithPostImagefor type-safe image registration - Runtime action wrapper discovery via naming convention
- Comprehensive test coverage (~30 tests) using hybrid compiled execution and snapshot testing
Reviewed changes
Copilot reviewed 43 out of 43 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| XrmPluginCore.csproj | Packages source generator as analyzer for NuGet distribution |
| Plugin.cs | Adds action wrapper discovery, signature validation, and registration metadata |
| PluginStepConfigBuilder.cs | Adds WithPreImage/WithPostImage convenience methods |
| PluginStepRegistration.cs | Adds metadata properties for wrapper generation and discovery |
| IEntityImageWrapper.cs, IActionWrapper.cs | New interfaces for generated wrappers |
| XrmPluginCore.SourceGenerator/* | Complete source generator implementation with parsers, validators, and code generators |
| XrmPluginCore.SourceGenerator.Tests/* | Comprehensive test suite with ~30 tests covering parsing, generation, compilation, and diagnostics |
| XrmPluginCore.Tests/* | Integration tests for type-safe plugin execution |
| README.md, CLAUDE.md | Updated documentation with type-safe images usage and patterns |
| .editorconfig | Enforces final newlines for consistency |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
XrmPluginCore.SourceGenerator/Validation/HandlerMethodValidator.cs
Outdated
Show resolved
Hide resolved
XrmPluginCore.SourceGenerator/CodeGeneration/WrapperClassGenerator.cs
Outdated
Show resolved
Hide resolved
7 tasks
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…orced build order so it will be there
…aversal (#3) * REFACTOR: Materialize inheritance chain results for better caching Co-authored-by: mkholt <4355246+mkholt@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mkholt <4355246+mkholt@users.noreply.github.com>
…ods without clashing with the Action overload
…ot benefit from generation so use the standard action instead.
…bout the action -> delegate implicit cast
… better location information, and automated code-fixes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces significant improvements to documentation, developer experience, and configuration for the XrmPluginCore project. The most notable changes are the addition and thorough documentation of the new
XrmPluginCore.SourceGeneratorlibrary, which provides compile-time type safety for plugin images, and enhanced instructions for dependency injection patterns. There are also updates to project configuration files to improve code style enforcement and expand allowed CLI commands.Source Generator and Type-Safe Images:
XrmPluginCore.SourceGeneratorlibrary, which generates type-safe wrapper classes for PreImage and PostImage parameters, enabling compile-time enforcement and IntelliSense support for plugin handlers. [1] [2] [3] [4]WithPreImage,WithPostImage,AddImage). [1] [2]Dependency Injection Patterns:
Project Configuration and Permissions:
.claude/settings.local.jsonto allow additional CLI commands (dotnet restore,dotnet clean,dotnet msbuild,dotnet pack,dotnet list, and common shell commands) and setoutputStyleto "default"..editorconfigto enforce final newlines at the end of files and added a dedicated.editorconfigfor the source generator test project to suppress specific warnings. [1] [2]Documentation and Compatibility:
README.mdandCLAUDE.mdto reflect new features, supported .NET versions, and improved explanations for plugin creation, DI, and image handling. Added badges for .NET Framework 4.6.2 and .NET 8 support. [1] [2]Service Injection:
IManagedIdentityServicefor Azure resource access using Managed Identity.