Repository navigation
Read write streamlining - #6317
NinoFloris wants to merge 33 commits into
Conversation
33734b1 to
de4ce7b
Compare
de4ce7b to
400870a
Compare
400870a to
7967f91
Compare
|
Not quite ready for review, but still the only way to get copilot reviews. |
There was a problem hiding this comment.
Pull request overview
This PR continues the “read/write streamlining” refactor (following #6316) by pushing more read/write call sites to use concrete type info plus explicit binding/context structs, reducing duplicated “provider vs concrete” branching and centralizing conversion decisions.
Changes:
- Replace per-column converter caching with
ReadConversionContext(concrete type info +PgFieldBinding) across readers/exporters/replication. - Rework parameter binding/writing around
PgConcreteTypeInfo,PgValueBinding, and nested object DBNull handling. - Introduce new internal helpers/structs (
Field.CreateUnspecified,NestedObjectDbNullHandling,ThrowHelper.ThrowUnreachableException, etc.) to support the new flow.
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| test/Npgsql.Tests/ReaderTests.cs | Updates reader init/start APIs to new binding/context signatures. |
| test/Npgsql.Tests/NpgsqlParameterTests.cs | Adjusts parameter resolution assertions to new resolution info shape. |
| test/Npgsql.Benchmarks/TypeHandlers/TypeHandlerBenchmarks.cs | Migrates benchmark read/write setup to PgValueBinding/PgFieldBinding and generic converters. |
| test/Npgsql.Benchmarks/GetFieldValue.cs | Minor benchmark config/comment tweak. |
| src/Npgsql/Util/TypeExtensions.cs | Adds subtype-relationship helper used by new requested-type logic. |
| src/Npgsql/TypeMapping/GlobalTypeMapper.cs | Simplifies datatype name inference via MakeConcreteForValueAsObject. |
| src/Npgsql/ThrowHelper.cs | Adds ThrowUnreachableException(string? message = null) overload. |
| src/Npgsql/Replication/PgOutput/ReplicationValue.cs | Switches replication value reads to ReadConversionContext and ReadFieldValue* helpers. |
| src/Npgsql/NpgsqlParameter`.cs | Reworks generic parameter typed-value binding/writing to new concrete/binding APIs. |
| src/Npgsql/NpgsqlParameter.cs | Major refactor of type resolution, binding, stream truncation handling, and writing pipeline. |
| src/Npgsql/NpgsqlNestedDataReader.cs | Moves nested reader conversion caching to ReadConversionContext. |
| src/Npgsql/NpgsqlDataReader.cs | Migrates main reader caching and read paths to ReadConversionContext. |
| src/Npgsql/NpgsqlBinaryImporter.cs | Updates resolution rollback logic to track concrete type info instead of converter/typeid trio. |
| src/Npgsql/NpgsqlBinaryExporter.cs | Refactors read paths to ReadConversionContext and field binding. |
| src/Npgsql/Internal/TypeInfoMapping.cs | Adjusts composed type info creation to use requestedType model (replacing unboxed/boxing logic). |
| src/Npgsql/Internal/TypeInfoCache.cs | Updates compatibility validation around IsStronglyTyped. |
| src/Npgsql/Internal/ResolverFactories/UnmappedTypeInfoResolverFactory.cs | Updates to ToStronglyTyped and requestedType plumbing. |
| src/Npgsql/Internal/ResolverFactories/NetworkTypeInfoResolverFactory.cs | Updates PgConcreteTypeInfo construction to use requestedType. |
| src/Npgsql/Internal/ResolverFactories/AdoTypeInfoResolverFactory.cs | Updates mappings to new requestedType semantics for text/stream/jsonb/bytea. |
| src/Npgsql/Internal/Postgres/Field.cs | Adds Field.CreateUnspecified helper for new binding paths. |
| src/Npgsql/Internal/PgWriter.cs | Introduces StartWrite/EndWrite and separates commit/reset accounting. |
| src/Npgsql/Internal/PgTypeInfo.cs | Large refactor: new concrete/provider responsibilities, plus PgFieldBinding/PgValueBinding and read/write helpers. |
| src/Npgsql/Internal/PgSerializerOptions.cs | Updates unspecified DBNull type info to new ctor (requestedType). |
| src/Npgsql/Internal/PgReader.cs | Changes Init parameter order and StartRead* to accept PgFieldBinding. |
| src/Npgsql/Internal/PgConverter.cs | Refines DBNull predicate model and adds nested-object DBNull handling configuration. |
| src/Npgsql/Internal/PgConcreteTypeInfoProvider.cs | Extends ProviderValueContext with NestedObjectDbNullHandling. |
| src/Npgsql/Internal/PgComposingTypeInfoProvider.cs | Updates composing providers for new requested-type propagation. |
| src/Npgsql/Internal/Converters/RecordConverter.cs | Uses MakeConcreteForField + BindField in nested reads. |
| src/Npgsql/Internal/Converters/PolymorphicArrayTypeInfoProvider.cs | Updates to new provider APIs (GetDefault/GetForField). |
| src/Npgsql/Internal/Converters/ObjectConverter.cs | Switches to new concrete/buffer requirements APIs. |
| src/Npgsql/Internal/Converters/NullableConverter.cs | Adapts composing provider API (CreateConverter(..., out requestedType)). |
| src/Npgsql/Internal/Converters/CastingConverter.cs | Makes casting converter public and updates type compatibility checks. |
| src/Npgsql/Internal/Converters/ArrayConverterCore.cs | Threads NestedObjectDbNullHandling through array sizing/writing state. |
| src/Npgsql/Internal/Converters/ArrayConverter.cs | Uses concrete type info sizing for nested object elements and updated provider APIs. |
| src/Npgsql/Internal/Composites/Metadata/CompositeFieldInfo.cs | Updates composite field read/write info selection to new concrete/binding APIs. |
| src/Npgsql/Internal/BufferRequirements.cs | Removes negative-size guard in GetMinimumBufferByteCount. |
| src/Npgsql/BackendMessages/RowDescriptionMessage.cs | Replaces ColumnInfo caching with ReadConversionContext and exposes GetConversionContext. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 37 out of 37 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
de72753 to
f4a685c
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (1)
test/Npgsql.Benchmarks/TypeHandlers/TypeHandlerBenchmarks.cs:54
- In the constructor,
handleris already typed asPgConverter<T>; the explicit cast to(PgConverter<T>)handleris redundant and only exists to enable the null-coalescing throw. Consider simplifying tohandler ?? throw ...(and optionally marking the parameter as nullable if you really want to allow null) to reduce noise in this benchmark base class.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 38 out of 38 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 41 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 41 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 41 out of 41 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Closing. The original goals of this PR, and more, have been implemented across a number of separate PRs due to the volume and diversity of changes. |
Subsequent changes based on #6316