Export (0) Print
Expand All
Expand Minimize

DbExpressionBuilder.Case Method

.NET Framework 4.5

Creates a new DbCaseExpression.

Namespace:  System.Data.Common.CommandTrees.ExpressionBuilder
Assembly:  System.Data.Entity (in System.Data.Entity.dll)

public static DbCaseExpression Case(
	IEnumerable<DbExpression> whenExpressions,
	IEnumerable<DbExpression> thenExpressions,
	DbExpression elseExpression
)

Parameters

whenExpressions
Type: System.Collections.Generic.IEnumerable<DbExpression>

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

thenExpressions
Type: System.Collections.Generic.IEnumerable<DbExpression>

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

elseExpression
Type: System.Data.Common.CommandTrees.DbExpression

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

Return Value

Type: System.Data.Common.CommandTrees.DbCaseExpression
A new DbCaseExpression with the specified cases and default result.

ExceptionCondition
ArgumentNullException

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

ArgumentException

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.

.NET Framework

Supported in: 4.6, 4.5
Show:
© 2015 Microsoft