Skip to content

fix: support CompileProjection with Include on abstract types (#801)#977

Open
leno23 wants to merge 1 commit into
MapsterMapper:developmentfrom
leno23:fix/projection-include-abstract-801-dev
Open

fix: support CompileProjection with Include on abstract types (#801)#977
leno23 wants to merge 1 commit into
MapsterMapper:developmentfrom
leno23:fix/projection-include-abstract-801-dev

Conversation

@leno23
Copy link
Copy Markdown

@leno23 leno23 commented May 25, 2026

Summary

Fixes #801 and adds regression coverage for #911.

Changes

  • ClassAdapter.CreateInlineExpression: handle abstract destination + Include for projection; avoid invalid NewExpression cast when instantiation is impossible.
  • ClassAdapter.CreateIncludeProjectionExpression: new helper mirroring runtime include redirect semantics for EF-translatable projection.
  • Tests in WhenIncludeDerivedClasses and WhenMappingRecordRegression.

Test plan

  • CI passes on development
  • CompileProjection_Including_Derived_Class compiles without exception
  • NotSelfCreationTypeMappingInContainingClassWithoutError passes
  • Existing include/projection tests remain green

Made with Cursor

…rMapper#801)

Generate TypeIs-based conditional projection expressions when mapping
abstract destination hierarchies with Include, and harden inline class
mapping when instantiation cannot produce a NewExpression.

Also add regression coverage for not-self-creation types inside
containing classes (MapsterMapper#911).

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

1 participant