DbExpressionBuilder.Case 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會產生一個新的 DbCaseExpression。
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);
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);
static member Case : seq<System.Data.Common.CommandTrees.DbExpression> * seq<System.Data.Common.CommandTrees.DbExpression> * System.Data.Common.CommandTrees.DbExpression -> System.Data.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 為空,或包含空,或 elseExpression 為空。
whenExpressions或thenExpressions為空,或whenExpressions包含非布林結果型態的表達式,或所有 與 中thenExpressionselseExpression所有表達式不存在共同結果型別。