Table of Contents

Class NpgsqlJsonDbFunctionsExtensions

Namespace
Microsoft.EntityFrameworkCore
Assembly
Npgsql.EntityFrameworkCore.PostgreSQL.dll

Provides methods for supporting translation to PostgreSQL JSON operators and functions.

public static class NpgsqlJsonDbFunctionsExtensions
Inheritance
NpgsqlJsonDbFunctionsExtensions
Inherited Members

Methods

JsonContained(DbFunctions, object, object)

Checks if contained is contained in json as top-level entries.

public static bool JsonContained(this DbFunctions _, object contained, object json)

Parameters

_ DbFunctions

DbFunctions instance

contained object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

json object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

Returns

bool

Remarks

This operation is only supported with PostgreSQL jsonb, not json. See https://www.postgresql.org/docs/current/functions-json.html.

JsonContains(DbFunctions, object, object)

Checks if json contains contained as top-level entries.

public static bool JsonContains(this DbFunctions _, object json, object contained)

Parameters

_ DbFunctions

DbFunctions instance

json object

A JSON column or value. Can be a JsonDocument, a string property mapped to JSON, or a user POCO mapped to JSON.

contained object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

Returns

bool

Remarks

This operation is only supported with PostgreSQL jsonb, not json. See https://www.postgresql.org/docs/current/functions-json.html.

JsonExistAll(DbFunctions, object, params string[])

Checks if all of the given keys exist as top-level keys within json.

public static bool JsonExistAll(this DbFunctions _, object json, params string[] keys)

Parameters

_ DbFunctions

DbFunctions instance

json object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

keys string[]

A set of keys to be checked inside json.

Returns

bool

Remarks

This operation is only supported with PostgreSQL jsonb, not json. See https://www.postgresql.org/docs/current/functions-json.html.

JsonExistAny(DbFunctions, object, params string[])

Checks if any of the given keys exist as top-level keys within json.

public static bool JsonExistAny(this DbFunctions _, object json, params string[] keys)

Parameters

_ DbFunctions

DbFunctions instance

json object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

keys string[]

A set of keys to be checked inside json.

Returns

bool

Remarks

This operation is only supported with PostgreSQL jsonb, not json. See https://www.postgresql.org/docs/current/functions-json.html.

JsonExists(DbFunctions, object, string)

Checks if key exists as a top-level key within json.

public static bool JsonExists(this DbFunctions _, object json, string key)

Parameters

_ DbFunctions

DbFunctions instance

json object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

key string

A key to be checked inside json.

Returns

bool

Remarks

This operation is only supported with PostgreSQL jsonb, not json. See https://www.postgresql.org/docs/current/functions-json.html.

JsonTypeof(DbFunctions, object)

Returns the type of the outermost JSON value as a text string. Possible types are object, array, string, number, boolean, and null.

public static string JsonTypeof(this DbFunctions _, object json)

Parameters

_ DbFunctions

DbFunctions instance

json object

A JSON column or value. Can be a JsonDocument, a string, or a user POCO mapped to JSON.

Returns

string

Remarks