@@ -138,6 +138,22 @@ public sealed class FieldDescription
138138 {
139139#pragma warning disable CS8618 // Lazy-initialized type
140140 internal FieldDescription ( ) { }
141+
142+ internal FieldDescription ( uint oid )
143+ : this ( "?" , 0 , 0 , oid , 0 , 0 , FormatCode . Binary ) { }
144+
145+ internal FieldDescription (
146+ string name , uint tableOID , short columnAttributeNumber ,
147+ uint oid , short typeSize , int typeModifier , FormatCode formatCode )
148+ {
149+ Name = name ;
150+ TableOID = tableOID ;
151+ ColumnAttributeNumber = columnAttributeNumber ;
152+ TypeOID = oid ;
153+ TypeSize = typeSize ;
154+ TypeModifier = typeModifier ;
155+ FormatCode = formatCode ;
156+ }
141157#pragma warning restore CS8618
142158
143159 internal FieldDescription ( FieldDescription source )
@@ -178,7 +194,7 @@ internal void Populate(
178194 /// <summary>
179195 /// The object ID of the field's data type.
180196 /// </summary>
181- internal uint TypeOID { get ; private set ; }
197+ internal uint TypeOID { get ; set ; }
182198
183199 /// <summary>
184200 /// The data type size (see pg_type.typlen). Note that negative values denote variable-width types.
@@ -205,17 +221,7 @@ internal void Populate(
205221 /// Currently will be zero (text) or one (binary).
206222 /// In a RowDescription returned from the statement variant of Describe, the format code is not yet known and will always be zero.
207223 /// </summary>
208- internal FormatCode FormatCode
209- {
210- get => _formatCode ;
211- set
212- {
213- _formatCode = value ;
214- ResolveHandler ( ) ;
215- }
216- }
217-
218- FormatCode _formatCode ;
224+ internal FormatCode FormatCode { get ; set ; }
219225
220226 internal string TypeDisplayName => PostgresType . GetDisplayNameWithFacets ( TypeModifier ) ;
221227
@@ -232,19 +238,20 @@ internal PostgresType PostgresType
232238
233239 internal Type FieldType => Handler . GetFieldType ( this ) ;
234240
235- void ResolveHandler ( )
236- {
237- Handler = IsBinaryFormat
238- ? _typeMapper . GetByOID ( TypeOID )
239- : _typeMapper . UnrecognizedTypeHandler ;
240- }
241+ internal void ResolveHandler ( )
242+ => Handler = IsBinaryFormat ? _typeMapper . GetByOID ( TypeOID ) : _typeMapper . UnrecognizedTypeHandler ;
241243
242244 ConnectorTypeMapper _typeMapper ;
243245
244246 internal bool IsBinaryFormat => FormatCode == FormatCode . Binary ;
245247 internal bool IsTextFormat => FormatCode == FormatCode . Text ;
246248
247- internal FieldDescription Clone ( ) => new FieldDescription ( this ) ;
249+ internal FieldDescription Clone ( )
250+ {
251+ var field = new FieldDescription ( this ) ;
252+ field . ResolveHandler ( ) ;
253+ return field ;
254+ }
248255
249256 /// <summary>
250257 /// Returns a string that represents the current object.
0 commit comments