DbExpressionBuilder.Case Method (IEnumerable<DbExpression>, IEnumerable<DbExpression>, DbExpression)
Creates a new DbCaseExpression.
Assembly: EntityFramework (in EntityFramework.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.Entity.Core.Common.CommandTrees.DbExpression
An expression that defines the result when no case is matched.
Return Value
Type: System.Data.Entity.Core.Common.CommandTrees.DbCaseExpressionA new DbCaseExpression with the specified cases and default result.
Exception | Condition |
---|---|
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. |