Сценарии
Версия 1.15 от Alexandr Fokin на 2024/04/13 14:38
JSON тип данных |
| |||||||||||||||
Parameters | public static class QueryParameterExtensions { public static NpgsqlParameter StructToDbParameter<T>( this T value, string name, NpgsqlDbType type ) where T : struct { return new NpgsqlParameter<T>(name, type) { TypedValue = value }; } public static NpgsqlParameter StructToDbParameter<T>( this T? value, string name, NpgsqlDbType type ) where T : struct { if (!value.HasValue) { return new NpgsqlParameter(name, type) { Value = DBNull.Value }; } return new NpgsqlParameter<T>(name, type) { TypedValue = value.Value }; } public static NpgsqlParameter ClassToDbParameter<T>( this T value, string name, NpgsqlDbType type ) where T : class { if (value == null) { return new NpgsqlParameter(name, type) { Value = DBNull.Value }; } return new NpgsqlParameter<T>(name, type) { TypedValue = value }; } } | |||||||||||||||