Table of Contents

Class JsonQueryExpression

Namespace
Microsoft.EntityFrameworkCore.Query
Assembly
Microsoft.EntityFrameworkCore.Relational.dll

An expression representing an entity or a collection of entities mapped to a JSON column and the path to access it.

This type is typically used by database providers (and other extensions). It is generally not used in application code.

public class JsonQueryExpression : Expression, IPrintableExpression
Inheritance
JsonQueryExpression
Implements
IPrintableExpression
Inherited Members

Constructors

JsonQueryExpression(IEntityType, ColumnExpression, IReadOnlyDictionary<IProperty, ColumnExpression>, Type, bool)

Creates a new instance of the JsonQueryExpression class.

public JsonQueryExpression(IEntityType entityType, ColumnExpression jsonColumn, IReadOnlyDictionary<IProperty, ColumnExpression> keyPropertyMap, Type type, bool collection)

Parameters

entityType IEntityType

An entity type being represented by this expression.

jsonColumn ColumnExpression

A column containing JSON value.

keyPropertyMap IReadOnlyDictionary<IProperty, ColumnExpression>

A map of key properties and columns they map to in the database.

type Type

A type of the element represented by this expression.

collection bool

A value indicating whether this expression represents a collection or not.

Properties

EntityType

The entity type being represented by this expression.

public virtual IEntityType EntityType { get; }

Property Value

IEntityType

IsCollection

The value indicating whether this expression represents a collection.

public virtual bool IsCollection { get; }

Property Value

bool

IsNullable

The value indicating whether this expression is nullable.

public virtual bool IsNullable { get; }

Property Value

bool

JsonColumn

The column containg JSON value.

public virtual ColumnExpression JsonColumn { get; }

Property Value

ColumnExpression

NodeType

public override ExpressionType NodeType { get; }

Property Value

ExpressionType

Path

The list of path segments leading to the entity from the root of the JSON stored in the column.

public virtual IReadOnlyList<PathSegment> Path { get; }

Property Value

IReadOnlyList<PathSegment>

Type

public override Type Type { get; }

Property Value

Type

Methods

BindNavigation(INavigation)

Binds a navigation with this JSON query expression to get the SQL representation.

public virtual JsonQueryExpression BindNavigation(INavigation navigation)

Parameters

navigation INavigation

The navigation to bind.

Returns

JsonQueryExpression

An JSON query expression for the target entity type of the navigation.

BindProperty(IProperty)

Binds a property with this JSON query expression to get the SQL representation.

public virtual SqlExpression BindProperty(IProperty property)

Parameters

property IProperty

Returns

SqlExpression

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

MakeNullable()

Makes this JSON query expression nullable.

public virtual JsonQueryExpression MakeNullable()

Returns

JsonQueryExpression

A new expression which has IsNullable property set to true.

Print(ExpressionPrinter)

public virtual void Print(ExpressionPrinter expressionPrinter)

Parameters

expressionPrinter ExpressionPrinter

Update(ColumnExpression, IReadOnlyDictionary<IProperty, ColumnExpression>)

Creates a new expression that is like this one, but using the supplied children. If all of the children are the same, it will return this expression.

public virtual JsonQueryExpression Update(ColumnExpression jsonColumn, IReadOnlyDictionary<IProperty, ColumnExpression> keyPropertyMap)

Parameters

jsonColumn ColumnExpression

The JsonColumn property of the result.

keyPropertyMap IReadOnlyDictionary<IProperty, ColumnExpression>

The map of key properties and columns they map to.

Returns

JsonQueryExpression

This expression if no children changed, or an expression with the updated children.

VisitChildren(ExpressionVisitor)

protected override Expression VisitChildren(ExpressionVisitor visitor)

Parameters

visitor ExpressionVisitor

Returns

Expression