Skip to content

Add read model abstraction - #4

Merged
PANiXiDA merged 2 commits into
mainfrom
feature/read-model-abstraction
Jul 30, 2026
Merged

Add read model abstraction#4
PANiXiDA merged 2 commits into
mainfrom
feature/read-model-abstraction

Conversation

@PANiXiDA

Copy link
Copy Markdown
Contributor

What changed

  • added the public abstract ReadModel record in PANiXiDA.Core.Application.Querying;
  • added a unit test demonstrating record-based inheritance;
  • updated query examples and repository guidance to keep Domain types out of read-side contracts.

Why

Application read repositories and query handlers need a common marker for immutable read-side result payloads. Naming alone cannot reliably distinguish a read model from an arbitrary DTO, while the base type enables consumer architecture tests without coupling the read side to Domain types.

Impact

Consumers can derive query and read repository result models from ReadModel. Existing APIs remain source-compatible because this is an additive public API change.

Validation

  • dotnet restore
  • dotnet format
  • dotnet build --configuration Release — 0 warnings, 0 errors
  • dotnet test --configuration Release — 48/48 passed

@PANiXiDA
PANiXiDA marked this pull request as ready for review July 30, 2026 11:52
@PANiXiDA
PANiXiDA merged commit 5e2bf82 into main Jul 30, 2026
4 checks passed
@PANiXiDA
PANiXiDA deleted the feature/read-model-abstraction branch July 30, 2026 11:52

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 64f78ac329

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread README.md
Comment on lines +88 to +91
Query result payloads should derive from `ReadModel`. Collections, pagination
models, and result wrappers may contain read models, but domain entities,
aggregate roots, value objects, enumerations, and strongly typed identifiers
must not cross the read-side boundary.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Use read models in the pagination examples

The newly documented boundary says pagination models should contain ReadModel payloads, but the immediately following page and cursor examples still use PaginationResult<string> and CursorPaginationResult<string>. Consumers following these examples will therefore adopt the exact primitive-result pattern this change discourages; update both examples to contain a record derived from ReadModel.

AGENTS.md reference: AGENTS.md:L63-L64

Useful? React with 👍 / 👎.

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