Title: [Order 07][P2] Review synchronous query resource lifetime for unenumerated results · Issue #64 · NEventStore/NEventStore.Persistence.SQL · GitHub
Open Graph Title: [Order 07][P2] Review synchronous query resource lifetime for unenumerated results · Issue #64 · NEventStore/NEventStore.Persistence.SQL
X Title: [Order 07][P2] Review synchronous query resource lifetime for unenumerated results · Issue #64 · NEventStore/NEventStore.Persistence.SQL
Description: Priority order Order: 07 of 09 Priority: P2 correctness/operability Problem Synchronous query APIs open database resources before returning lazy enumerables. Evidence: src/NEventStore.Persistence.Sql/SqlPersistenceEngine.cs:460 ExecuteQu...
Open Graph Description: Priority order Order: 07 of 09 Priority: P2 correctness/operability Problem Synchronous query APIs open database resources before returning lazy enumerables. Evidence: src/NEventStore.Persistence.S...
X Description: Priority order Order: 07 of 09 Priority: P2 correctness/operability Problem Synchronous query APIs open database resources before returning lazy enumerables. Evidence: src/NEventStore.Persistence.S...
Opengraph URL: https://github.com/NEventStore/NEventStore.Persistence.SQL/issues/64
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Order 07][P2] Review synchronous query resource lifetime for unenumerated results","articleBody":"## Priority order\n\nOrder: 07 of 09\nPriority: P2 correctness/operability\n\n## Problem\n\nSynchronous query APIs open database resources before returning lazy enumerables.\n\nEvidence:\n\n- `src/NEventStore.Persistence.Sql/SqlPersistenceEngine.cs:460`\n- `ExecuteQuery` opens connection/transaction/statement before returning the lazy enumerable.\n- Disposal depends on the returned enumerable being enumerated and disposed.\n\n## Impact\n\n- Callers that create but do not enumerate a result can leak an open connection/command.\n- Common LINQ terminal operations dispose correctly, but non-enumerated results are easy to miss.\n\n## Mandatory test-first workflow\n\n- Add tests first that reproduce or verify resource lifetime behavior.\n- Include a fake connection/statement test proving whether resources open before enumeration.\n- Include a test proving disposal on early termination.\n- Do not change resource-lifetime behavior until the intended contract is encoded in tests.\n\n## Proposed action\n\n- Consider making sync query methods iterator blocks that open resources on enumeration.\n- Alternatively document the disposal contract and add coverage for common paths if changing behavior is too risky.\n\n## Acceptance criteria\n\n- Resource lifetime behavior is explicit and tested.\n- Early enumeration termination disposes resources.\n- The selected contract is documented if lazy enumerable behavior remains.\n\nSource: `docs/Project-Analysis-Issue-Drafts.md`.","author":{"url":"https://github.com/AGiorgetti","@type":"Person","name":"AGiorgetti"},"datePublished":"2026-06-11T09:21:39.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/64/NEventStore.Persistence.SQL/issues/64"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0c89add9-2269-3dae-5143-66a714feb8aa |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C3CE:1CB805:597E79:79CBCC:6A4DA952 |
| html-safe-nonce | 54ae5268621e086311c1988c5c22ffca5373a31bb21756e6f0029e4a9af15e07 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDM0NFOjFDQjgwNTo1OTdFNzk6NzlDQkNDOjZBNERBOTUyIiwidmlzaXRvcl9pZCI6IjQxNDU2MzA1NjMzNDcwNDg3ODYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | af0fd8ce651d9997f7377a66bcfbe2bd05004315e5ab92d8ca4881e99607b045 |
| hovercard-subject-tag | issue:4639068682 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NEventStore/NEventStore.Persistence.SQL/64/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0fe29f31ae3100fae80e5314e66dc7c0c4f5f65cbae31606007c92253ab217f7/NEventStore/NEventStore.Persistence.SQL/issues/64 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0fe29f31ae3100fae80e5314e66dc7c0c4f5f65cbae31606007c92253ab217f7/NEventStore/NEventStore.Persistence.SQL/issues/64 |
| og:image:alt | Priority order Order: 07 of 09 Priority: P2 correctness/operability Problem Synchronous query APIs open database resources before returning lazy enumerables. Evidence: src/NEventStore.Persistence.S... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | AGiorgetti |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/NEventStore/NEventStore.Persistence.SQL git https://github.com/NEventStore/NEventStore.Persistence.SQL.git |
| octolytics-dimension-user_id | 4486767 |
| octolytics-dimension-user_login | NEventStore |
| octolytics-dimension-repository_id | 36130556 |
| octolytics-dimension-repository_nwo | NEventStore/NEventStore.Persistence.SQL |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36130556 |
| octolytics-dimension-repository_network_root_nwo | NEventStore/NEventStore.Persistence.SQL |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 47723578ce6819210724ef064c858fce6d3115a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width