src/Shared/EntityFramework/Core/Mapping/ViewGeneration/Structures/CaseStatement.cs
// <summary>
// Generates CQT for the current <see cref="CaseStatement" />.
// </summary>
Generates CQT for the current .
Generates CQT for the current .
internal DbExpression AsCqt(DbExpression row, IEnumerable<WithRelationship> withRelationships)
        {
            var conditions = new List<DbExpression>();
            var values = new List<DbExpression>();
            foreach (var clause in Clauses)
            {
                conditions.Add(clause.Condition.AsCqt(row));
                values.Add(CaseSlotValueAsCqt(row, clause.Value, MemberPath, withRelationships));
            }
            var elseValue = ElseValue != null
                                ? CaseSlotValueAsCqt(row, ElseValue, MemberPath, withRelationships)
                                : Constant.Null.AsCqt(row, MemberPath);
            if (Clauses.Count > 0)
            {
                return DbExpressionBuilder.Case(conditions, values, elseValue);
            }
            else
            {
                Debug.Assert(elseValue != null, "CASE statement with no WHEN/THENs must have ELSE.");
                return elseValue;
            }
        }
internal DbExpression AsCqt ( DbExpression row , IEnumerable < WithRelationship > withRelationships ) { var conditions = new List < DbExpression > ( ) ; var values = new List < DbExpression > ( ) ; foreach ( var clause in Clauses ) { conditions . Add ( clause . Condition . AsCqt ( row ) ) ; values . Add ( CaseSlotValueAsCqt ( row , clause . Value , MemberPath , withRelationships ) ) ; } var elseValue = ElseValue != null ? CaseSlotValueAsCqt ( row , ElseValue , MemberPath , withRelationships ) : Constant . Null . AsCqt ( row , MemberPath ) ; if ( Clauses . Count > 0 ) { return DbExpressionBuilder . Case ( conditions , values , elseValue ) ; } else { Debug . Assert ( elseValue != null , " " ) ; return elseValue ; } }
Generates CQT for the current .
Generates CQT for the current .
// Generate the Case WHEN .. THEN ..., WHEN ... THEN ..., END // Generate ELSE
row
DbExpression
withRelationships
IEnumerable<WithRelationship>