Skip to content

AzureDocumentDB: register Mongo conventions once per record type - #68

Merged
adamsitnik merged 1 commit into
CommunityToolkit:mainfrom
Empiree:fix/documentdb-convention-registry
Oct 12, 2026
Merged

adamsitnik merged 1 commit into
CommunityToolkit:mainfrom
Empiree:fix/documentdb-convention-registry

Conversation

@Empiree

@Empiree Empiree commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

MongoMapper registered its conventions in the constructor, so every new collection added one more entry to ConventionRegistry. Now it happens once in a static constructor, same as in mongodb/mongo-mevd-provider#9

Added a test that creates a few collections and checks number of conventions doesnt change. It fails before the fix and passes after. Also bumped the provider version to 1.0.2

Fixes #64

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.

🟢 Approval recommended

The focused fix addresses the registry leak, includes regression coverage, and follows provider versioning requirements.

0 open findings

What changed in this PR

Registers MongoDB conventions once per record type, preventing unbounded registry growth.

Changes:

  • Moves convention registration to the generic mapper’s static constructor.
  • Adds regression coverage.
  • Bumps the provider version to 1.0.2.
File Description
MongoMapper.cs Registers conventions once per record type.
DocumentDBCollectionTests.cs Verifies repeated collection creation does not add conventions.
AzureDocumentDB.csproj Bumps the package patch version.

🧠 Review effort: Balanced


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

@adamsitnik adamsitnik 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.

LGTM, thank you for your contribution @Empiree !

@adamsitnik
adamsitnik merged commit 7696f35 into CommunityToolkit:main Oct 12, 2026
33 of 34 checks passed
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.

AzureDocumentDB: ConventionRegistry gets a new entry for every collection

3 participants