DbExpressionBuilder.Case(IEnumerable<DbExpression>, IEnumerable<DbExpression>, DbExpression) 方法
定义
创建一个新的 DbCaseExpression。Creates a new 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>
提供每个 Case 的条件的表达式列表。A list of expressions that provide the conditional for of each case.
- thenExpressions
- IEnumerable<DbExpression>
提供每个 Case 的结果的表达式列表。A list of expressions that provide the result of each case.
- elseExpression
- DbExpression
定义没有 Case 匹配时的结果的表达式。An expression that defines the result when no case is matched.
返回
使用指定的案件和默认结果的新 DbCaseExpression。A new DbCaseExpression with the specified cases and default result.
例外
whenExpressions 或 thenExpressions 为 null 或包含 null,或者 elseExpression 为 null。whenExpressions or thenExpressions is null or contains null, or elseExpression is null.
whenExpressions 或 thenExpressions 为空,或者 whenExpressions 包含一个带有非布尔结果类型的表达式,或者没有适用于 thenExpressions 和 elseExpression 中的所有表达式的通用结果类型。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.