@@ -16,14 +16,13 @@ public sealed class PgSerializerOptions
1616 internal static bool IntrospectionCaller { get ; set ; }
1717
1818 readonly Func < string > ? _timeZoneProvider ;
19- readonly object _typeInfoCache ;
19+ object ? _typeInfoCache ;
2020
2121 internal PgSerializerOptions ( NpgsqlDatabaseInfo databaseInfo , Func < string > ? timeZoneProvider = null )
2222 {
2323 _timeZoneProvider = timeZoneProvider ;
2424 DatabaseInfo = databaseInfo ;
2525 UnknownPgType = databaseInfo . GetPostgresType ( "unknown" ) ;
26- _typeInfoCache = PortableTypeIds ? new TypeInfoCache < DataTypeName > ( this ) : new TypeInfoCache < Oid > ( this ) ;
2726 }
2827
2928 // Represents the 'unknown' type, which can be used for reading and writing arbitrary text values.
@@ -62,8 +61,8 @@ internal bool IntrospectionMode
6261 // for.
6362 PgTypeInfo ? GetTypeInfoCore ( Type ? type , PgTypeId ? pgTypeId , bool defaultTypeFallback )
6463 => PortableTypeIds
65- ? Unsafe . As < TypeInfoCache < DataTypeName > > ( _typeInfoCache ) . GetOrAddInfo ( type , pgTypeId ? . DataTypeName , defaultTypeFallback )
66- : Unsafe . As < TypeInfoCache < Oid > > ( _typeInfoCache ) . GetOrAddInfo ( type , pgTypeId ? . Oid , defaultTypeFallback ) ;
64+ ? Unsafe . As < TypeInfoCache < DataTypeName > > ( _typeInfoCache ??= new TypeInfoCache < DataTypeName > ( this ) ) . GetOrAddInfo ( type , pgTypeId ? . DataTypeName , defaultTypeFallback )
65+ : Unsafe . As < TypeInfoCache < Oid > > ( _typeInfoCache ??= new TypeInfoCache < Oid > ( this ) ) . GetOrAddInfo ( type , pgTypeId ? . Oid , defaultTypeFallback ) ;
6766
6867 public PgTypeInfo ? GetDefaultTypeInfo ( PostgresType pgType )
6968 => GetTypeInfoCore ( null , ToCanonicalTypeId ( pgType ) , false ) ;
0 commit comments