Share via


SqlExpressionFactory.Case Method

Definition

Overloads

Case(SqlExpression, CaseWhenClause[])
Obsolete.

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

Case(IReadOnlyList<CaseWhenClause>, SqlExpression)

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

Case(SqlExpression, SqlExpression, CaseWhenClause[])
Case(SqlExpression, IReadOnlyList<CaseWhenClause>, SqlExpression)

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

Case(SqlExpression, IReadOnlyList<CaseWhenClause>, SqlExpression, SqlExpression)

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

Case(SqlExpression, CaseWhenClause[])

Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs

Caution

Use overload which takes IReadOnlyList instead of params

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression operand, params Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] whenClauses);
[System.Obsolete("Use overload which takes IReadOnlyList instead of params")]
public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression operand, params Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] whenClauses);
abstract member Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
override this.Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
[<System.Obsolete("Use overload which takes IReadOnlyList instead of params")>]
abstract member Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
override this.Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
Public Overridable Function Case (operand As SqlExpression, ParamArray whenClauses As CaseWhenClause()) As CaseExpression

Parameters

operand
SqlExpression

An expression to compare with Test in whenClauses.

whenClauses
CaseWhenClause[]

A list of CaseWhenClause to compare and get result from.

Returns

An expression representing a CASE statement in a SQL tree.

Implements

Attributes

Applies to

Case(IReadOnlyList<CaseWhenClause>, SqlExpression)

Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> whenClauses, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression elseResult);
public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> whenClauses, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? elseResult);
public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression Case (System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> whenClauses, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? elseResult);
abstract member Case : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
override this.Case : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
abstract member Case : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression
override this.Case : System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression
Public Overridable Function Case (whenClauses As IReadOnlyList(Of CaseWhenClause), elseResult As SqlExpression) As CaseExpression
Public Overridable Function Case (whenClauses As IReadOnlyList(Of CaseWhenClause), elseResult As SqlExpression) As SqlExpression

Parameters

whenClauses
IReadOnlyList<CaseWhenClause>

A list of CaseWhenClause to evaluate condition and get result from.

elseResult
SqlExpression

A value to return if no whenClauses matches, if any.

Returns

An expression representing a CASE statement in a SQL tree.

Implements

Applies to

Case(SqlExpression, SqlExpression, CaseWhenClause[])

Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression operand, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression elseResult, params Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] whenClauses);
abstract member Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
override this.Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause[] -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
Public Overridable Function Case (operand As SqlExpression, elseResult As SqlExpression, ParamArray whenClauses As CaseWhenClause()) As CaseExpression

Parameters

operand
SqlExpression
elseResult
SqlExpression
whenClauses
CaseWhenClause[]

Returns

Applies to

Case(SqlExpression, IReadOnlyList<CaseWhenClause>, SqlExpression)

Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs
Source:
SqlExpressionFactory.cs

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression operand, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> whenClauses, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression elseResult);
public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression Case (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? operand, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> whenClauses, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? elseResult);
abstract member Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
override this.Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseExpression
Public Overridable Function Case (operand As SqlExpression, whenClauses As IReadOnlyList(Of CaseWhenClause), elseResult As SqlExpression) As CaseExpression

Parameters

operand
SqlExpression

An expression to compare with Test in whenClauses.

whenClauses
IReadOnlyList<CaseWhenClause>

A list of CaseWhenClause to compare and get result from.

elseResult
SqlExpression

A value to return if no whenClauses matches, if any.

Returns

An expression representing a CASE statement in a SQL tree.

Implements

Applies to

Case(SqlExpression, IReadOnlyList<CaseWhenClause>, SqlExpression, SqlExpression)

Source:
SqlExpressionFactory.cs

Creates a new CaseExpression which represent a CASE statement in a SQL tree.

public virtual Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression Case (Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? operand, System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> whenClauses, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? elseResult, Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression? existingExpression = default);
abstract member Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression
override this.Case : Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * System.Collections.Generic.IReadOnlyList<Microsoft.EntityFrameworkCore.Query.SqlExpressions.CaseWhenClause> * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression * Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression -> Microsoft.EntityFrameworkCore.Query.SqlExpressions.SqlExpression
Public Overridable Function Case (operand As SqlExpression, whenClauses As IReadOnlyList(Of CaseWhenClause), elseResult As SqlExpression, Optional existingExpression As SqlExpression = Nothing) As SqlExpression

Parameters

operand
SqlExpression

An expression to compare with Test in whenClauses.

whenClauses
IReadOnlyList<CaseWhenClause>

A list of CaseWhenClause to compare or evaluate and get result from.

elseResult
SqlExpression

A value to return if no whenClauses matches, if any.

existingExpression
SqlExpression

An optional expression that can be re-used if it matches the new expression.

Returns

An expression representing a CASE statement in a SQL tree.

Implements

Applies to