Сценарии
Версия 1.2 от Alexandr Fokin на 2023/10/31 19:41
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 | |
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 }; } } |