/
dev-npgsql
/
npgsql
Обзор
Документация
Войти
/
dev-npgsql
/
npgsql
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
v9.0.2
src/Npgsql.NodaTime/NpgsqlNodaTimeExtensions.cs
32 строки
1 KB
Nino Floris
Concrete INpgsqlTypeMapper return types (#5918)
10 ноя 2024, 14:45
Не верифицирован
10 ноя 2024, 14:45
4f2785b
Код
Авторство
О чём код?
using Npgsql.NodaTime.Internal; using Npgsql.TypeMapping; // ReSharper disable once CheckNamespace namespace Npgsql; /// <summary> /// Extension adding the NodaTime plugin to an Npgsql type mapper. /// </summary> public static class NpgsqlNodaTimeExtensions { // Note: defined for binary compatibility and NpgsqlConnection.GlobalTypeMapper. /// <summary> /// Sets up NodaTime mappings for the PostgreSQL date/time types. /// </summary> /// <param name="mapper">The type mapper to set up (global or connection-specific)</param> public static INpgsqlTypeMapper UseNodaTime(this INpgsqlTypeMapper mapper) { mapper.AddTypeInfoResolverFactory(new NodaTimeTypeInfoResolverFactory()); return mapper; } /// <summary> /// Sets up NodaTime mappings for the PostgreSQL date/time types. /// </summary> /// <param name="mapper">The type mapper to set up (global or connection-specific)</param> public static TMapper UseNodaTime<TMapper>(this TMapper mapper) where TMapper : INpgsqlTypeMapper { mapper.AddTypeInfoResolverFactory(new NodaTimeTypeInfoResolverFactory()); return mapper; } }