Изменения документа Сценарии
Редактировал(а) Alexandr Fokin 2024/12/07 13:48
<
отредактировано Alexandr Fokin
на 2024/12/07 13:48
на 2024/12/07 13:48
отредактировано Alexandr Fokin
на 2023/10/31 19:41
на 2023/10/31 19:41
Изменить комментарий:
К данной версии нет комментариев
Комментарий
-
Свойства страницы (1 изменено, 0 добавлено, 0 удалено)
Подробности
- Свойства страницы
-
- Содержимое
-
... ... @@ -1,23 +1,47 @@ 1 ----- 1 +| |Can JSONB GIN indexes be specified in CodeFirst EntityFramework with NPGSQL? 2 +[[https:~~/~~/stackoverflow.com/questions/54618858/can-jsonb-gin-indexes-be-specified-in-codefirst-entityframework-with-npgsql>>https://stackoverflow.com/questions/54618858/can-jsonb-gin-indexes-be-specified-in-codefirst-entityframework-with-npgsql]] 3 +|Parameters|{{code language="c#"}}public static class QueryParameterExtensions 4 +{ 5 + public static NpgsqlParameter StructToDbParameter<T>( 6 + this T value, 7 + string name, 8 + NpgsqlDbType type 9 + ) 10 + where T : struct 11 + { 12 + return new NpgsqlParameter<T>(name, type) { TypedValue = value }; 13 + } 2 2 3 -==== Внутренние ссылки: ==== 15 + public static NpgsqlParameter StructToDbParameter<T>( 16 + this T? value, 17 + string name, 18 + NpgsqlDbType type 19 + ) 20 + where T : struct 21 + { 22 + if (!value.HasValue) 23 + { 24 + return new NpgsqlParameter(name, type) { Value = DBNull.Value }; 25 + } 4 4 5 -====== Дочерние страницы: ====== 27 + return new NpgsqlParameter<T>(name, type) { TypedValue = value.Value }; 28 + } 6 6 7 -{{children/}} 30 + public static NpgsqlParameter ClassToDbParameter<T>( 31 + this T value, 32 + string name, 33 + NpgsqlDbType type 34 + ) 35 + where T : class 36 + { 37 + if (value == null) 38 + { 39 + return new NpgsqlParameter(name, type) { Value = DBNull.Value }; 40 + } 8 8 9 -====== Обратные ссылки: ====== 42 + return new NpgsqlParameter<T>(name, type) { TypedValue = value }; 43 + } 44 +}{{/code}} 45 +| | 10 10 11 -{{velocity}} 12 -#set ($links = $doc.getBacklinks()) 13 -#if ($links.size() > 0) 14 - #foreach ($docname in $links) 15 - #set ($rdoc = $xwiki.getDocument($docname).getTranslatedDocument()) 16 - * [[$escapetool.xml($rdoc.fullName)]] 17 - #end 18 -#else 19 - No back links for this page! 20 -#end 21 -{{/velocity}} 22 - 23 ----- 47 +