Skip to content

Add shared image interfaces (IPluginImage/IPluginPreImage/IPluginPostImage)#13

Merged
mkholt merged 2 commits into
mainfrom
plugin-image-interface-2ac
Jun 22, 2026
Merged

Add shared image interfaces (IPluginImage/IPluginPreImage/IPluginPostImage)#13
mkholt merged 2 commits into
mainfrom
plugin-image-interface-2ac

Conversation

@mkholt

@mkholt mkholt commented Jun 19, 2026

Copy link
Copy Markdown
Member

Replace IEntityImageWrapper 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 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 removed; use IPluginImage.

…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>

Copilot AI left a comment

Copy link
Copy Markdown

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 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 removed IEntityImageWrapper<T>.
  • Updated the source generator to have generated Pre/Post image wrappers implement the new interfaces and always expose Id and LogicalName.
  • 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.

Comment thread XrmPluginCore.SourceGenerator.Tests/README.md
Comment thread XrmPluginCore.SourceGenerator.Tests/README.md
Comment thread XrmPluginCore/IPluginImage.cs Outdated
- 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>
@mkholt mkholt merged commit f2e2a71 into main Jun 22, 2026
1 check passed
@mkholt mkholt deleted the plugin-image-interface-2ac branch June 22, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants