forked from npgsql/npgsql
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNpgsqlTypeHandlerFactory.cs
More file actions
50 lines (45 loc) · 2.01 KB
/
NpgsqlTypeHandlerFactory.cs
File metadata and controls
50 lines (45 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
using Npgsql.PostgresTypes;
using Npgsql.TypeMapping;
namespace Npgsql.TypeHandling
{
/// <summary>
/// Base class for all type handler factories, which construct type handlers that know how
/// to read and write CLR types from/to PostgreSQL types.
/// </summary>
/// <remarks>
/// In general, do not inherit from this class, inherit from <see cref="NpgsqlTypeHandlerFactory{T}"/> instead.
/// </remarks>
public abstract class NpgsqlTypeHandlerFactory
{
/// <summary>
/// Creates a type handler.
/// </summary>
public abstract NpgsqlTypeHandler CreateNonGeneric(PostgresType pgType, NpgsqlConnection conn);
/// <summary>
/// The default CLR type that handlers produced by this factory will read and write.
/// </summary>
public abstract Type DefaultValueType { get; }
}
/// <summary>
/// Base class for all type handler factories, which construct type handlers that know how
/// to read and write CLR types from/to PostgreSQL types. Type handler factories are set up
/// via <see cref="NpgsqlTypeMapping"/> in either the global or connection-specific type mapper.
/// </summary>
/// <seealso cref="NpgsqlTypeMapping"/>
/// <seealso cref="NpgsqlConnection.GlobalTypeMapper"/>
/// <seealso cref="NpgsqlConnection.TypeMapper"/>
/// <typeparam name="TDefault">The default CLR type that handlers produced by this factory will read and write.</typeparam>
public abstract class NpgsqlTypeHandlerFactory<TDefault> : NpgsqlTypeHandlerFactory
{
/// <summary>
/// Creates a type handler.
/// </summary>
public abstract NpgsqlTypeHandler<TDefault> Create(PostgresType pgType, NpgsqlConnection conn);
/// <inheritdoc />
public override NpgsqlTypeHandler CreateNonGeneric(PostgresType pgType, NpgsqlConnection conn)
=> Create(pgType, conn);
/// <inheritdoc />
public override Type DefaultValueType => typeof(TDefault);
}
}