-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/typesafe images #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
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 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
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
…orced build order so it will be there
…aversal (#3) * REFACTOR: Materialize inheritance chain results for better caching Co-authored-by: mkholt <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: mkholt <[email protected]>
…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 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.