Skip to content

Fix DynamicModel sample store isolation - #5451

Open
AndriySvyryd with Copilot wants to merge 2 commits into
mainfrom
copilot/dynamicmodel-sample-issue-fix
Open

Fix DynamicModel sample store isolation#5451
AndriySvyryd with Copilot wants to merge 2 commits into
mainfrom
copilot/dynamicmodel-sample-issue-fix

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

The DynamicModel sample throws on EF Core 8 and later because incompatible models share the same InMemory database. The sample already targets EF Core 10.

  • Store isolation
    • Derive the database name from UseIntProperty.
    • Keep each model’s differently shaped value buffers in a separate store.
.UseInMemoryDatabase($"DynamicContext-{UseIntProperty}")

Co-authored-by: AndriySvyryd <6539701+AndriySvyryd@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix DynamicModel sample throwing exception with EF8 Fix DynamicModel sample store isolation Aug 19, 2026
Copilot AI requested a review from AndriySvyryd August 19, 2026 01:15
@AndriySvyryd
AndriySvyryd marked this pull request as ready for review August 19, 2026 20:45
@AndriySvyryd
AndriySvyryd requested review from cincuranet and a lite review from Copilot August 19, 2026 20:45

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 fixes a runtime failure in the DynamicModel EF Core sample (EF Core 8+) caused by sharing the same InMemory database across two incompatible model shapes. It isolates the InMemory store per model variant, aligning the provider store with the model cache key behavior already driven by UseIntProperty.

Changes:

  • Derive the InMemory database name from UseIntProperty to prevent incompatible models from sharing the same underlying store.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

DynamicModel sample throws with EF8

3 participants