src/Shared/EntityFramework/Core/Mapping/Update/Internal/Propagator.Evaluator.cs
// <summary>
// Returns the result of evaluating a case expression.
// </summary>
// <param name="node"> Case expression node. </param>
// <returns> Result of evaluating case expression over the input row for this visitor. </returns>
Returns the result of evaluating a case expression.
Returns the result of evaluating a case expression .
public override PropagatorResult Visit(DbCaseExpression node)
            {
                Check.NotNull(node, "node");
                var match = -1;
                var statementOrdinal = 0;
                var inputs = new List<PropagatorResult>();
                foreach (var when in node.When)
                {
                    var whenResult = Visit(when);
                    inputs.Add(whenResult);
                    var matches = ConvertResultToBool(whenResult) ?? false; 
                    if (matches)
                    {
                        match = statementOrdinal;
                        break;
                    }
                    statementOrdinal++;
                }
                PropagatorResult matchResult;
                if (-1 == match)
                {
                    matchResult = Visit(node.Else);
                }
                else
                {
                    matchResult = Visit(node.Then[match]);
                }
                inputs.Add(matchResult);
                var resultFlags = PropagateUnknownAndPreserveFlags(matchResult, inputs);
                var result = matchResult.ReplicateResultWithNewFlags(resultFlags);
                return result;
            }
public override PropagatorResult Visit ( DbCaseExpression node ) { Check . NotNull ( node , " " ) ; var match = - 1 ; var statementOrdinal = 0 ; var inputs = new List < PropagatorResult > ( ) ; foreach ( var when in node . When ) { var whenResult = Visit ( when ) ; inputs . Add ( whenResult ) ; var matches = ConvertResultToBool ( whenResult ) ?? false ; if ( matches ) { match = statementOrdinal ; break ; } statementOrdinal ++ ; } PropagatorResult matchResult ; if ( - 1 == match ) { matchResult = Visit ( node . Else ) ; } else { matchResult = Visit ( node . Then [ match ] ) ; } inputs . Add ( matchResult ) ; var resultFlags = PropagateUnknownAndPreserveFlags ( matchResult , inputs ) ; var result = matchResult . ReplicateResultWithNewFlags ( resultFlags ) ; return result ; }
Returns the result of evaluating a case expression.
Returns the result of evaluating a case expression .
// ternary logic resolution // Clone the result to avoid modifying expressions that may be used elsewhere // (design invariant: only set markup for expressions you create)
Result of evaluating case expression over the input row for this visitor.
Result of evaluating case expression over the input row for this visitor .
node
DbCaseExpression
Case expression node.
Case expression node .