Skip to content

Commit daef2e2

Browse files
committed
Exposed range subtype in PostgresRangeType
1 parent da7adbe commit daef2e2

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/Npgsql/PostgresTypes/PostgresRangeType.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
2222
#endregion
2323

24+
using JetBrains.Annotations;
25+
2426
namespace Npgsql.PostgresTypes
2527
{
2628
/// <summary>
@@ -31,27 +33,31 @@ namespace Npgsql.PostgresTypes
3133
/// </remarks>
3234
public class PostgresRangeType : PostgresType
3335
{
34-
readonly PostgresType _subtype;
36+
/// <summary>
37+
/// The PostgreSQL data type of the subtype of this range.
38+
/// </summary>
39+
[PublicAPI]
40+
public PostgresType Subtype { get; }
3541

3642
/// <summary>
3743
/// Constructs a representation of a PostgreSQL range data type.
3844
/// </summary>
3945
protected internal PostgresRangeType(string ns, string name, uint oid, PostgresType subtypePostgresType)
4046
: base(ns, name, oid)
4147
{
42-
_subtype = subtypePostgresType;
48+
Subtype = subtypePostgresType;
4349
if (subtypePostgresType.NpgsqlDbType.HasValue)
4450
NpgsqlDbType = NpgsqlTypes.NpgsqlDbType.Range | subtypePostgresType.NpgsqlDbType;
45-
_subtype.Range = this;
51+
Subtype.Range = this;
4652
}
4753

4854
internal override TypeHandler Activate(TypeHandlerRegistry registry)
4955
{
5056
TypeHandler subtypeHandler;
51-
if (!registry.TryGetByOID(_subtype.OID, out subtypeHandler))
57+
if (!registry.TryGetByOID(Subtype.OID, out subtypeHandler))
5258
{
5359
// Subtype hasn't been set up yet, do it now
54-
subtypeHandler = _subtype.Activate(registry);
60+
subtypeHandler = Subtype.Activate(registry);
5561
}
5662

5763
var handler = subtypeHandler.CreateRangeHandler(this);

0 commit comments

Comments
 (0)