Изменения документа Сценарии
Редактировал(а) Alexandr Fokin 2024/12/07 13:48
<
отредактировано Alexandr Fokin
на 2024/12/07 13:48
на 2024/12/07 13:48
отредактировано Alexandr Fokin
на 2024/02/24 15:13
на 2024/02/24 15:13
Изменить комментарий:
К данной версии нет комментариев
Комментарий
-
Свойства страницы (1 изменено, 0 добавлено, 0 удалено)
Подробности
- Свойства страницы
-
- Содержимое
-
... ... @@ -1,23 +1,58 @@ 1 ----- 1 +|(% style="width:141px" %) |(% style="width:1372px" %) 2 +|(% style="width:141px" %)[[JSON>>doc:Разработка.Схемы данных, контракты, форматы.Text.JSON.WebHome]] тип данных|(% style="width:1372px" %)((( 3 +| |Can JSONB GIN indexes be specified in CodeFirst EntityFramework with NPGSQL? 4 +[[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]] 5 +|Тип сущности|((( 6 +JSON Mapping 7 +[[https:~~/~~/www.npgsql.org/efcore/mapping/json.html?tabs=data-annotations%2Cpoco>>https://www.npgsql.org/efcore/mapping/json.html?tabs=data-annotations%2Cpoco]] 2 2 3 -==== Внутренние ссылки: ==== 9 +[[System. Text. Json>>doc:Разработка.NET.Библиотеки.Документы.Форматы данных и схемы.NET Json.System\. Text\. Json.WebHome]] 10 +Позволяет использовать JsonDocument и JsonElement. 11 +))) 12 +| | 13 +))) 14 +|(% style="width:141px" %)Parameters|(% style="width:1372px" %){{code language="c#"}}public static class QueryParameterExtensions 15 +{ 16 + public static NpgsqlParameter StructToDbParameter<T>( 17 + this T value, 18 + string name, 19 + NpgsqlDbType type 20 + ) 21 + where T : struct 22 + { 23 + return new NpgsqlParameter<T>(name, type) { TypedValue = value }; 24 + } 4 4 5 -====== Дочерние страницы: ====== 26 + public static NpgsqlParameter StructToDbParameter<T>( 27 + this T? value, 28 + string name, 29 + NpgsqlDbType type 30 + ) 31 + where T : struct 32 + { 33 + if (!value.HasValue) 34 + { 35 + return new NpgsqlParameter(name, type) { Value = DBNull.Value }; 36 + } 6 6 7 -{{children/}} 38 + return new NpgsqlParameter<T>(name, type) { TypedValue = value.Value }; 39 + } 8 8 9 -====== Обратные ссылки: ====== 41 + public static NpgsqlParameter ClassToDbParameter<T>( 42 + this T value, 43 + string name, 44 + NpgsqlDbType type 45 + ) 46 + where T : class 47 + { 48 + if (value == null) 49 + { 50 + return new NpgsqlParameter(name, type) { Value = DBNull.Value }; 51 + } 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}} 53 + return new NpgsqlParameter<T>(name, type) { TypedValue = value }; 54 + } 55 +}{{/code}} 56 +|(% style="width:141px" %) |(% style="width:1372px" %) 22 22 23 - ----58 +