Align Sqlite enrich behavior#1282
Open
DavidGarton8 wants to merge 1 commit intoCommunityToolkit:mainfrom
Open
Conversation
Make EnrichSqliteDatabaseDbContext follow the Aspire enrich pattern by requiring the DbContext to already be registered instead of registering it itself. Update the tests to reflect the new contract, including coverage for missing DbContext registration and successful enrichment of an existing registration.
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1282Or
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1282" |
Author
|
@dotnet-policy-service agree |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1269
Make
EnrichSqliteDatabaseDbContextfollow the Aspire enrich pattern by requiring theDbContextto already be registered instead of registering it itself.This updates the SQLite enrichment behavior to match the expected enrich contract used elsewhere in Aspire integrations.
EnrichSqliteDatabaseDbContext<TDbContext>now validates thatTDbContextis already registered in DI and then applies enrichment features such as health checks, logging, retries, and telemetry.The test suite has also been updated to reflect this behavior:
DbContextis already registeredInvalidOperationExceptionis thrown when theDbContexthas not been registeredPR Checklist
Other information
This is a breaking behavioral change intended to align this API with the existing Aspire enrich pattern.
EnrichSqliteDatabaseDbContext<TDbContext>previously registered theDbContextitself, but after this change it requires theDbContextto already be registered and only applies enrichment behavior.This follows the intended Aspire enrich pattern by allowing consumers to register the
DbContexthowever they want before applying enrichment.This is a deliberate contract alignment change, and the impact should be limited because this method was only introduced in preview/beta packages and was not part of an official stable release.
Migration
Before:
After: