Прочетете на английски Редактиране

Споделяне чрез


DbExpressionBuilder.Case Method

Definition

Creates a new DbCaseExpression.

C#
public static System.Data.Common.CommandTrees.DbCaseExpression Case(System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> whenExpressions, System.Collections.Generic.IEnumerable<System.Data.Common.CommandTrees.DbExpression> thenExpressions, System.Data.Common.CommandTrees.DbExpression elseExpression);

Parameters

whenExpressions
IEnumerable<DbExpression>

A list of expressions that provide the conditional for of each case.

thenExpressions
IEnumerable<DbExpression>

A list of expressions that provide the result of each case.

elseExpression
DbExpression

An expression that defines the result when no case is matched.

Returns

A new DbCaseExpression with the specified cases and default result.

Exceptions

whenExpressions or thenExpressions is null or contains null, or elseExpression is null.

whenExpressions or thenExpressions is empty or whenExpressions contains an expression with a non-Boolean result type, or no common result type exists for all expressions in thenExpressions and elseExpression.

Applies to

Продукт Версии
.NET Framework 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1