11#region License
2+
23// The PostgreSQL License
34//
45// Copyright (C) 2018 The Npgsql Development Team
1920// AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
2021// ON AN "AS IS" BASIS, AND THE NPGSQL DEVELOPMENT TEAM HAS NO OBLIGATIONS
2122// TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
23+
2224#endregion
2325
2426using System ;
2527using System . Collections . Generic ;
26- using System . Linq ;
27- using System . Text ;
28- using System . Threading . Tasks ;
28+ using JetBrains . Annotations ;
2929using Npgsql . NameTranslation ;
3030using NpgsqlTypes ;
3131
32+ // ReSharper disable UnusedMember.Global
3233namespace Npgsql . TypeMapping
3334{
3435 /// <summary>
3536 /// A type mapper, managing how to read and write CLR values to PostgreSQL data types.
3637 /// A type mapper exists for each connection, as well as a single global type mapper
37- /// (accessible via
38+ /// (accessible via <see cref="P:NpgsqlConnection.GlobalTypeMapper"/>).
3839 /// </summary>
3940 /// <remarks>
4041 /// </remarks>
42+ [ PublicAPI ]
4143 public interface INpgsqlTypeMapper
4244 {
4345 /// <summary>
44- /// Adds a new type mapping to this mapper, overwriting any existing mapping in the process .
46+ /// The default name translator to convert CLR type names and member names .
4547 /// </summary>
46- INpgsqlTypeMapper AddMapping ( NpgsqlTypeMapping mapping ) ;
48+ [ NotNull ]
49+ INpgsqlNameTranslator DefaultNameTranslator { get ; }
4750
4851 /// <summary>
49- /// Removes an existing mapping from this mapper. Attempts to read or write this type
50- /// after removal will result in an exception.
52+ /// Enumerates all mappings currently set up on this type mapper.
5153 /// </summary>
52- bool RemoveMapping ( string pgTypeName ) ;
54+ [ NotNull ]
55+ [ ItemNotNull ]
56+ IEnumerable < NpgsqlTypeMapping > Mappings { get ; }
5357
5458 /// <summary>
55- /// Enumerates all mappings currently set up on this type mapper.
59+ /// Adds a new type mapping to this mapper, overwriting any existing mapping in the process .
5660 /// </summary>
57- IEnumerable < NpgsqlTypeMapping > Mappings { get ; }
61+ [ NotNull ]
62+ INpgsqlTypeMapper AddMapping ( [ NotNull ] NpgsqlTypeMapping mapping ) ;
63+
64+ /// <summary>
65+ /// Removes an existing mapping from this mapper. Attempts to read or write this type
66+ /// after removal will result in an exception.
67+ /// </summary>
68+ /// <param name="pgTypeName">A PostgreSQL type name for the type in the database.</param>
69+ bool RemoveMapping ( [ NotNull ] string pgTypeName ) ;
5870
5971 /// <summary>
6072 /// Maps a CLR enum to a PostgreSQL enum type.
@@ -76,7 +88,10 @@ public interface INpgsqlTypeMapper
7688 /// Defaults to <see cref="NpgsqlSnakeCaseNameTranslator"/>
7789 /// </param>
7890 /// <typeparam name="TEnum">The .NET enum type to be mapped</typeparam>
79- INpgsqlTypeMapper MapEnum < TEnum > ( string pgName = null , INpgsqlNameTranslator nameTranslator = null )
91+ [ NotNull ]
92+ INpgsqlTypeMapper MapEnum < TEnum > (
93+ [ CanBeNull ] string pgName = null ,
94+ [ CanBeNull ] INpgsqlNameTranslator nameTranslator = null )
8095 where TEnum : struct , Enum ;
8196
8297 /// <summary>
@@ -90,7 +105,9 @@ INpgsqlTypeMapper MapEnum<TEnum>(string pgName = null, INpgsqlNameTranslator nam
90105 /// A component which will be used to translate CLR names (e.g. SomeClass) into database names (e.g. some_class).
91106 /// Defaults to <see cref="NpgsqlSnakeCaseNameTranslator"/>
92107 /// </param>
93- bool UnmapEnum < TEnum > ( string pgName = null , INpgsqlNameTranslator nameTranslator = null )
108+ bool UnmapEnum < TEnum > (
109+ [ CanBeNull ] string pgName = null ,
110+ [ CanBeNull ] INpgsqlNameTranslator nameTranslator = null )
94111 where TEnum : struct , Enum ;
95112
96113 /// <summary>
@@ -113,7 +130,10 @@ bool UnmapEnum<TEnum>(string pgName = null, INpgsqlNameTranslator nameTranslator
113130 /// Defaults to <see cref="NpgsqlSnakeCaseNameTranslator"/>
114131 /// </param>
115132 /// <typeparam name="T">The .NET type to be mapped</typeparam>
116- INpgsqlTypeMapper MapComposite < T > ( string pgName = null , INpgsqlNameTranslator nameTranslator = null ) where T : new ( ) ;
133+ [ NotNull ]
134+ INpgsqlTypeMapper MapComposite < T > (
135+ [ CanBeNull ] string pgName = null ,
136+ [ CanBeNull ] INpgsqlNameTranslator nameTranslator = null ) where T : new ( ) ;
117137
118138 /// <summary>
119139 /// Removes an existing enum mapping.
@@ -126,7 +146,9 @@ bool UnmapEnum<TEnum>(string pgName = null, INpgsqlNameTranslator nameTranslator
126146 /// A component which will be used to translate CLR names (e.g. SomeClass) into database names (e.g. some_class).
127147 /// Defaults to <see cref="NpgsqlSnakeCaseNameTranslator"/>
128148 /// </param>
129- bool UnmapComposite < T > ( string pgName = null , INpgsqlNameTranslator nameTranslator = null ) where T : new ( ) ;
149+ bool UnmapComposite < T > (
150+ [ CanBeNull ] string pgName = null ,
151+ [ CanBeNull ] INpgsqlNameTranslator nameTranslator = null ) where T : new ( ) ;
130152
131153 /// <summary>
132154 /// Resets all mapping changes performed on this type mapper and reverts it to its original, starting state.
0 commit comments