Support AddDbContextPool and AddDbContextFactory
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 42/100
Research direction
Start with the DbContext options registration and the DbCallCountingInterceptor in the library source, and look at how HttpCallCountingHandler gets the per-request DbCallCounter through IHttpContextAccessor. Tests live in tests/NimblePros.Metronome.Tests; add cases for AddDbContextPool and AddDbContextFactory and check that counts stay separate across requests. Done when those tests pass, the new no-provider overload exists, and the README note is removed.
Written by the indexing model from the issue text.
Description
AddMetronomeDbTracking(provider) resolves the scoped DbCallCountingInterceptor, which holds the request's DbCallCounter. That only works with AddDbContext((provider, options) => ...), where the options are built in the request scope.
With AddDbContextPool or AddDbContextFactory, the options are built once and shared. That either fails scope validation or captures one counter and counts calls across all requests. The README currently says these registrations aren't supported.
Proposal
Look up the counter for each command through IHttpContextAccessor, the way HttpCallCountingHandler already does:
- Register the interceptor as a singleton.
- On each command, get
HttpContext?.RequestServices.GetService<DbCallCounter>(), and skip counting when there's no request. - Add an overload that doesn't need the
providerargument, and keep the current one for compatibility.
Done when
- Tests in
tests/NimblePros.Metronome.Testscover pooled and factory-created contexts and confirm that counts stay per request. - The README note about these registrations is removed.
- Dominant language
- C#
- Stars
- 26
- Forks
- 0
- Avg merge
- 6h 17m
- Merged PRs (30d)
- 2
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NimblePros/Metronome
-
Difficulty 1/5 1-3 hours Newbie friendliness 72/100
NimblePros/Metronome#23 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NimblePros/Metronome#19 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
NimblePros/Metronome#18 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 62/100
NimblePros/Metronome#22 ·
-
discussion
Difficulty 4/5 3-5 days Newbie friendliness 25/100
NimblePros/Metronome#21 ·
All issues in NimblePros/Metronome
Similar issues
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 88/100
erkamyaman/rust-anything#610 ·
Maintainers usually reply within 1 day
-
enhancement frontend good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
[Linux] The portal's color-scheme 0 (no preference) means light, not "not known"Possibly taken @ramlanrinos claimed this today. Openarea: linux bug ready
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
ZaidX88/sluice#284 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Forrest-Technologies/drover#958 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day