Add shared image interfaces (IPluginImage/IPluginPreImage/IPluginPostImage)#13
Merged
Conversation
…Image) Replace IEntityImageWrapper<T> with a richer interface hierarchy for generated plugin images so handler methods can share functionality across the per-registration concrete image types. - Add IPluginImage (non-generic) and IPluginImage<TEntity> with type-safe Entity access, plus IPluginPreImage/IPluginPostImage marker variants. - Always expose Id and LogicalName on images (available on every Entity), surfaced on the non-generic IPluginImage for fully generic helpers. - Generated PreImage/PostImage implement the new interfaces; skip any attribute mapping to Id/LogicalName to avoid duplicate members. - HandlerSignatureMismatchAnalyzer now accepts interface-typed parameters, validating image kind (pre/post) and entity type for generic variants. - Update tests, CHANGELOG (v1.3.0), and CLAUDE.md docs. BREAKING: IEntityImageWrapper<T> removed; use IPluginImage<TEntity>. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
There was a problem hiding this comment.
Pull request overview
This PR replaces the old IEntityImageWrapper<T> contract with a richer shared interface hierarchy (IPluginImage, IPluginImage<TEntity>, IPluginPreImage*, IPluginPostImage*) so handler methods can accept interface-typed image parameters and share logic across per-registration generated image wrapper types.
Changes:
- Added shared image interfaces (
IPluginImage*,IPluginPreImage*,IPluginPostImage*) and removedIEntityImageWrapper<T>. - Updated the source generator to have generated Pre/Post image wrappers implement the new interfaces and always expose
IdandLogicalName. - Updated analyzers, tests, docs, and changelog for the new interface-based image typing.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| XrmPluginCore/IPluginImage.cs | Adds the new shared plugin image interface hierarchy (generic + marker interfaces). |
| XrmPluginCore/IEntityImageWrapper.cs | Removes the old IEntityImageWrapper<T> interface (breaking change). |
| XrmPluginCore/CHANGELOG.md | Documents v1.3.0 additions and the breaking removal. |
| XrmPluginCore.SourceGenerator/Constants.cs | Adds constants for the shared image interface names. |
| XrmPluginCore.SourceGenerator/CodeGeneration/WrapperClassGenerator.cs | Updates generated image wrappers to implement shared interfaces and expose Id/LogicalName. |
| XrmPluginCore.SourceGenerator/Analyzers/HandlerSignatureMismatchAnalyzer.cs | Expands signature validation to accept interface-typed image parameters (generic + non-generic). |
| XrmPluginCore.SourceGenerator.Tests/README.md | Updates test documentation to reference the new interfaces (but still contains some inaccurate coverage claims). |
| XrmPluginCore.SourceGenerator.Tests/IntegrationTests/CompilationTests.cs | Adds runtime/reflection assertions for Id and LogicalName, plus compilation coverage for interface-typed handlers. |
| XrmPluginCore.SourceGenerator.Tests/GenerationTests/WrapperClassGenerationTests.cs | Updates generation assertions to expect the new interface implementations. |
| XrmPluginCore.SourceGenerator.Tests/DiagnosticTests/DiagnosticReportingTests.cs | Adds analyzer tests for shared interface parameters and mismatch scenarios. |
| CLAUDE.md | Updates generated code examples and documents the new shared image interfaces. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use Constants.Pre/PostImageInterfaceName in the generator instead of hard-coded interface name literals. - Validate generic image-interface entity type with SymbolEqualityComparer.Default rather than comparing simple names, avoiding false matches between same-named types in different namespaces. - Fix misleading test README coverage list (ToEntity<T>/GetUnderlyingEntity do not exist) to reflect actual coverage. - Reformat IPluginImage.cs to tabs per .editorconfig. Co-Authored-By: Claude <noreply@anthropic.com> via Conducktor <conducktor@contextand.com>
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.
Replace IEntityImageWrapper with a richer interface hierarchy for generated plugin images so handler methods can share functionality across the per-registration concrete image types.
BREAKING: IEntityImageWrapper removed; use IPluginImage.