共用方式為


DbExpressionBuilder.Case 方法

定義

建立新的 DbCaseExpression

public static System.Data.Entity.Core.Common.CommandTrees.DbCaseExpression Case(System.Collections.Generic.IEnumerable<System.Data.Entity.Core.Common.CommandTrees.DbExpression> whenExpressions, System.Collections.Generic.IEnumerable<System.Data.Entity.Core.Common.CommandTrees.DbExpression> thenExpressions, System.Data.Entity.Core.Common.CommandTrees.DbExpression elseExpression);
static member Case : seq<System.Data.Entity.Core.Common.CommandTrees.DbExpression> * seq<System.Data.Entity.Core.Common.CommandTrees.DbExpression> * System.Data.Entity.Core.Common.CommandTrees.DbExpression -> System.Data.Entity.Core.Common.CommandTrees.DbCaseExpression
Public Function Case (whenExpressions As IEnumerable(Of DbExpression), thenExpressions As IEnumerable(Of DbExpression), elseExpression As DbExpression) As DbCaseExpression

參數

whenExpressions
IEnumerable<DbExpression>

運算式清單,提供各種案例的條件。

thenExpressions
IEnumerable<DbExpression>

運算式清單,提供各種案例的結果。

elseExpression
DbExpression

運算式,定義在沒有符合任何案例時的結果。

傳回

具有指定之大小寫及預設結果的新 DbCaseExpression。

例外狀況

whenExpressions 或 thenExpressions 為 null 或包含 null,或 elseExpression 為 null。

whenExpressions 或 thenExpressions 是空的,或是當Expressions 包含具有非布林結果類型的運算式,或是 thenExpressions 和 elseExpression 中所有運算式都不存在任何常見的結果類型。

適用於