Skip to content

feat(dotnet): add QueryDoctor.SqlCommenter.EFCore package#4

Merged
veksen merged 1 commit intomasterfrom
feat-sqlcommenter-efcore
Feb 26, 2026
Merged

feat(dotnet): add QueryDoctor.SqlCommenter.EFCore package#4
veksen merged 1 commit intomasterfrom
feat-sqlcommenter-efcore

Conversation

@veksen
Copy link
Member

@veksen veksen commented Feb 26, 2026

Summary

  • Add QueryDoctor.SqlCommenter.EFCore 8.0.0 — an EF Core interceptor that appends SQLCommenter-formatted comments to SQL queries for query attribution and observability
  • Includes 37 tests (unit tests with NSubstitute + SQLite in-memory integration tests)
  • Published to NuGet.org as QueryDoctor.SqlCommenter.EFCore

What's included

Library (dotnet/sqlcommenter-efcore/src/):

  • SqlCommenterInterceptor — intercepts all 6 EF Core command methods (Reader/NonQuery/Scalar x sync/async)
  • QueryTaggingContext — AsyncLocal ambient context for explicit query tagging
  • QueryTagInfo — comment formatting with URL encoding, sorted keys per SQLCommenter spec
  • DbContextOptionsBuilderExtensions — ergonomic .AddSqlCommenter() registration
  • SqlCommenterOptions — configuration (enabled, stack inspection, framework version)

Tests (dotnet/sqlcommenter-efcore/test/):

  • 12 QueryTagInfo formatting tests
  • 11 SqlCommenterInterceptor unit tests (mocked DbCommand)
  • 4 SQLite in-memory integration tests (real SQL pipeline)
  • 8 QueryTaggingContext lifecycle tests
  • 2 extension method registration tests

CI: .github/workflows/dotnet-efcore-tests.yaml — runs on dotnet/** changes

Usage:

options.UseSqlServer(connectionString).AddSqlCommenter();

Test plan

  • dotnet build — 0 errors, 0 warnings
  • dotnet test — 37/37 passing
  • dotnet pack — produces .nupkg + .snupkg

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@veksen veksen force-pushed the feat-sqlcommenter-efcore branch from bace350 to 5b14ee3 Compare February 26, 2026 14:53
@veksen veksen merged commit 944f75a into master Feb 26, 2026
4 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.

1 participant