Skip to content

Split reading work entries from writing them in a unit of work - #174

Merged
vesnicancz merged 1 commit into
masterfrom
refactor/work-entry-reader
Nov 4, 2026
Merged

vesnicancz merged 1 commit into
masterfrom
refactor/work-entry-reader

Conversation

@vesnicancz

Copy link
Copy Markdown
Owner

Builds on #172. Now that every write runs in a unit of work, WorkEntryRepository no longer needs its two modes, one opening a context per call and saving, the other sharing one and leaving the save to the unit of work. Nothing used the first for writes anymore, but everything could.

  • IWorkEntryReader is what WorkEntryService and others use for reads outside a transaction. WorkEntryReader opens its own context per read and is what DI registers.
  • IWorkEntryRepository extends it with the writes and exists only inside a unit of work. It can't be resolved from DI anymore, so a write outside a transaction doesn't compile rather than just being discouraged.
  • The queries live once in WorkEntryQueries. ContextScope is gone.
  • The new interface takes CancellationToken without a default, and so do the repository methods.

No behaviour change and no database change. New WorkEntryReaderTests run on SQLite rather than the EF in-memory provider, so the queries get translated as they do in the application. Whole solution passes.

@vesnicancz
vesnicancz force-pushed the refactor/work-entry-intents branch from 19e059d to 347ba54 Compare November 4, 2026 22:28
@vesnicancz
vesnicancz force-pushed the refactor/work-entry-reader branch from 37e2e68 to 52c8071 Compare November 4, 2026 22:28
Base automatically changed from refactor/work-entry-intents to master November 4, 2026 22:31
WorkEntryRepository no longer has two modes, and writes outside of a transaction no longer compile.
@vesnicancz
vesnicancz force-pushed the refactor/work-entry-reader branch from 52c8071 to dbc93f9 Compare November 4, 2026 22:34
@vesnicancz
vesnicancz merged commit 541c7b1 into master Nov 4, 2026
5 checks passed
@vesnicancz
vesnicancz deleted the refactor/work-entry-reader branch November 4, 2026 22:37
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