refactor(ef): split EntityFramework into a provider-neutral core + Postgres package#179
Merged
Merged
Conversation
Bump Microsoft.Extensions.* and the EF Core trio to 10.0.9, Npgsql.EFCore to 10.0.2, AspNetCore.OpenApi to 10.0.9, Swashbuckle to 10.2.2, Spectre.Console to 0.57.0, Test.Sdk to 18.6.0, coverlet.collector to 10.0.1. All within the net10 line; xunit stays on 2.x (no v3 migration). Chrysalis and Utxorpc alpha pins and the already-latest Mongo/bench packages unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…stgres package Argus.Sync.EntityFramework becomes the provider-neutral EF Core backend — CardanoDbContext, the EF unit-of-work, and a new public AddCardanoEntityFrameworkIndexer<T>(configureProvider) seam — and now depends on Microsoft.EntityFrameworkCore.Relational instead of Npgsql. The PostgreSQL/Npgsql specifics move to a new Argus.Sync.EntityFramework.Postgres package: AddCardanoPostgresIndexer<T> (a thin UseNpgsql wrapper over the core seam) plus the advisory-lock worker, renamed PostgresSingleInstanceLockWorker -> PostgresSingleInstanceLock to match the sibling MongoSingleInstanceLock. This mirrors the EF Core ecosystem (core + per-provider packages) and makes adding SQLite/SQL Server later a sibling wrapper. Implements the structural half of #178. BREAKING: AddCardanoPostgresIndexer consumers must add the Argus.Sync.EntityFramework.Postgres package and a `using Argus.Sync.EntityFramework.Postgres;`. Also fixes the commandTimeout typo, makes the core docs provider-neutral, and wires the new package into the Example, Tests, release.yml, ci.yml, and README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Splits the Entity Framework backend into a provider-neutral core (Argus.Sync.EntityFramework) plus a new Postgres provider package (Argus.Sync.EntityFramework.Postgres), and updates dependency versions and wiring across examples, tests, CI, and release packaging to match the new package layout.
Changes:
- Introduces
AddCardanoEntityFrameworkIndexer<T>(configureProvider)in the core EF package and movesUseNpgsql+ advisory-lock wiring into a new Postgres provider package. - Renames and relocates the Postgres single-instance lock implementation to the new provider package and updates tests/example accordingly.
- Updates docs, workflows, and packing lists to include the new package; refreshes shared NuGet package versions.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/Argus.Sync.Tests/EndToEnd/SingleInstanceLockTest.cs | Updates test to use the new Postgres provider namespace and renamed lock type. |
| src/Argus.Sync.Tests/EndToEnd/IndexerRegistrationTest.cs | Updates DI assertions for the renamed lock type and provider namespace. |
| src/Argus.Sync.Tests/Argus.Sync.Tests.csproj | Adds project reference to the new Postgres provider project. |
| src/Argus.Sync.Example/Program.cs | Switches example registration to Argus.Sync.EntityFramework.Postgres. |
| src/Argus.Sync.Example/Argus.Sync.Example.csproj | Adds project reference to the new Postgres provider project. |
| src/Argus.Sync.EntityFramework/EfServiceCollectionExtensions.cs | Replaces Postgres-specific registration with provider-neutral AddCardanoEntityFrameworkIndexer. |
| src/Argus.Sync.EntityFramework/EfBlockUnitOfWorkFactory.cs | Minor refactor: uses IDbContextTransaction via a namespace import. |
| src/Argus.Sync.EntityFramework/CardanoDbContext.cs | Documentation wording updated to be provider-neutral. |
| src/Argus.Sync.EntityFramework/Argus.Sync.EntityFramework.csproj | Removes Npgsql dependency; references Microsoft.EntityFrameworkCore.Relational for provider-neutral core. |
| src/Argus.Sync.EntityFramework.Postgres/PostgresSingleInstanceLock.cs | Moves/renames the Postgres lock into the provider package namespace. |
| src/Argus.Sync.EntityFramework.Postgres/PostgresServiceCollectionExtensions.cs | Adds new Postgres-specific DI entry point wrapping the provider-neutral seam. |
| src/Argus.Sync.EntityFramework.Postgres/Argus.Sync.EntityFramework.Postgres.csproj | Adds new provider package project referencing core + Npgsql EF provider. |
| README.md | Updates installation and usage instructions to reference the new provider package. |
| Directory.Packages.props | Refreshes centralized package versions (EF Core, Npgsql EF provider, tooling, etc.). |
| .github/workflows/release.yml | Adds packing of the new Postgres provider package. |
| .github/workflows/ci.yml | Includes the new Postgres provider package in CI packing loop. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+38
to
+39
| /// <item>The fault propagates out of <see cref="Workers.CardanoIndexWorker"/>'s execute loop, | ||
| /// which stops the host (the default <see cref="Microsoft.Extensions.Hosting.BackgroundService"/> behavior).</item> |
Argus.Sync.EntityFramework, Argus.Sync.EntityFramework.Postgres, and Argus.Sync.MongoDb were building only transitively (via the Example/Tests project references) and were absent from Argus.slnx. List all 7 projects so a solution build compiles every backend in the chosen configuration directly (they now emit to bin/Release on a Release build instead of bin/Debug). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Splits
Argus.Sync.EntityFrameworkinto the EF Core ecosystem's shape — a provider-neutral core plus a per-provider package — and refreshes dependencies along the way. Two commits:chore(deps)— refresh NuGet packages to latest within the net10 line (Microsoft.Extensions.* + EF Core trio → 10.0.9, Npgsql.EFCore → 10.0.2, AspNetCore.OpenApi → 10.0.9, Swashbuckle → 10.2.2, Spectre.Console → 0.57.0, Test.Sdk → 18.6.0, coverlet → 10.0.1).xunitstays on 2.x (no v3 migration); Chrysalis/Utxorpc alpha pins untouched.refactor(ef)— the package split (below).The split
Argus.Sync.EntityFrameworkCardanoDbContext, the EF unit-of-work, and the new publicAddCardanoEntityFrameworkIndexer<T>(configureProvider)seamArgus.Sync+Microsoft.EntityFrameworkCore.RelationalArgus.Sync.EntityFramework.Postgres(new)AddCardanoPostgresIndexer<T>(a thinUseNpgsqlwrapper) + the advisory single-instance lockArgus.Sync.EntityFramework+Npgsql.EntityFrameworkCore.PostgreSQLAddCardanoPostgresIndexeris now a small wrapper that (1) builds theUseNpgsqldelegate, (2) registers the Postgres lock, (3) calls the core seam. Adding SQLite/SQL Server later is a sibling wrapper over the same seam — this lands the structural half of #178.The advisory-lock worker is renamed
PostgresSingleInstanceLockWorker→PostgresSingleInstanceLockto match the siblingMongoSingleInstanceLock(git tracked it as a rename).Consumers of
AddCardanoPostgresIndexermust now:Argus.Sync.EntityFramework.Postgrespackage (it pulls in the core transitively), andusing Argus.Sync.EntityFramework.Postgres;.Acceptable in alpha; suggests a notable bump (e.g. v1.3.0-alpha) at release. The pm2 stability consumers will need the new package on their next bump (not touched here).
Also
commandTimout→commandTimeouttypo on the public registration.IndexerRegistrationTest,SingleInstanceLockTest), therelease.yml+ci.ymlpack lists, and the README.Verification
dotnet build -c Release— 0 warnings, 0 errors.dotnet format --verify-no-changes— clean.dotnet test --filter "Category!=Integration&Category!=DataGeneration"— 22 passed;IndexerRegistrationTestprovesAddCardanoPostgresIndexerstill wires the EF seam + renamed lock + worker.dotnet packboth EF packages — nuspecs confirm core →Microsoft.EntityFrameworkCore.Relational(no Npgsql); Postgres →Argus.Sync.EntityFramework+ Npgsql.Out of scope
No new provider (SQLite/etc.) and no generic lease-lock — the remaining half of #178 (each non-Postgres provider needs its own
ISingleInstanceLock). TheCardanoNodeConnection:RollbackBufferkey is unchanged (consistent with Mongo + the live consumers).🤖 Generated with Claude Code