Split EF Core integration into StrEnum.Npgsql.EntityFrameworkCore#3
Merged
dmytro-khmara merged 1 commit intomasterfrom Apr 26, 2026
Merged
Split EF Core integration into StrEnum.Npgsql.EntityFrameworkCore#3dmytro-khmara merged 1 commit intomasterfrom
dmytro-khmara merged 1 commit intomasterfrom
Conversation
This is a breaking change. StrEnum.Npgsql now ships only the wire-level
Postgres-enum support for the Npgsql ADO.NET driver. EF Core integration
moves to a new package, StrEnum.Npgsql.EntityFrameworkCore, mirroring how
the Npgsql ecosystem itself splits Npgsql.NetTopologySuite (driver) from
Npgsql.EntityFrameworkCore.PostgreSQL.NetTopologySuite (EF wrapper).
Removed:
- ModelBuilderExtensions, PropertyBuilderExtensions,
DbContextOptionsBuilderExtensions
- StringEnumValueConverter, StringEnumValueConverterSelector,
ChainedValueConverterSelectorDecorator, StringEnumPropertyValueConverter
- All EF Core-shaped unit tests
Kept:
- NpgsqlDataSourceBuilderExtensions.MapStringEnum<T> (now the public
surface), with overloads for INpgsqlTypeMapper to mirror MapEnum<T>
- The wire-level resolver / converter pair under Internal/
Added:
- Testcontainers-based integration test that round-trips a StringEnum<T>
against a real Postgres enum column via raw Npgsql commands
- Integration-tests CI job that runs against Docker on the GitHub runner
Other changes:
- Dependency narrowed from Npgsql.EntityFrameworkCore.PostgreSQL to Npgsql
- Targets narrowed from net6.0..net10.0 to net8.0..net10.0 (the
PgTypeInfoResolverFactory API is Npgsql 8+)
- InternalsVisibleTo("StrEnum.Npgsql.EntityFrameworkCore") so the EF
wrapper can reuse PostgresNaming and StringEnumLabels without
promoting them to public API
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.
Summary
Breaking change splitting StrEnum.Npgsql into two packages — driver-level Postgres-enum support stays here; EF Core integration moves to a new package,
StrEnum.Npgsql.EntityFrameworkCore(separate PR).What changed in
StrEnum.NpgsqlNpgsqlDataSourceBuilder.MapStringEnum<T>— the wire-level resolver-factory + converter pair that was already here. Overloads forINpgsqlTypeMapperandNpgsqlSlimDataSourceBuildermirror Npgsql's ownMapEnum<T>shape.ModelBuilderExtensions,PropertyBuilderExtensions,DbContextOptionsBuilderExtensions, the value-converter selector trio, and theStringEnumPropertyValueConverter. They're moving toStrEnum.Npgsql.EntityFrameworkCorealongside a newIRelationalTypeMappingSourcePluginthat finally closes the wire-binding gap end-to-end (tracked in the sibling PR).Npgsql.EntityFrameworkCore.PostgreSQL→Npgsql. Raw Npgsql / Dapper consumers no longer pay an EF Core tax.net6.0;net7.0;net8.0;net9.0;net10.0→net8.0;net9.0;net10.0. ThePgTypeInfoResolverFactoryAPI is Npgsql 8+, so older targets weren't getting the resolver anyway.InternalsVisibleTo("StrEnum.Npgsql.EntityFrameworkCore")so the EF wrapper can reusePostgresNamingandStringEnumLabelswithout promoting them to public API.Migration for consumers
Anyone currently using EF Core needs to install
StrEnum.Npgsql.EntityFrameworkCoreinstead. The model/property/options-builder API is unchanged in shape; the EF integration just now sits in the right package.New integration tests
A Testcontainers-backed integration project verifies the wire-level resolver round-trips a
StringEnum<T>against a real Postgresenumcolumn via raw Npgsql commands. Wired intobuild.ymlas a separateintegration-testsjob (Docker on the GitHub runner; the existing Docker-based unit-test job stays unchanged).Versioning
This PR is the basis of
StrEnum.Npgsql2.0.Test plan
dotnet test— 10 unit + 1 integration round-trip pass on net10.0Npgsql.EntityFrameworkCore.PostgreSQLno longer appears in the package's transitive depsMapStringEnum<T>against a fresh consumer using the unreleased package