src/Shared/EntityFramework/Core/Mapping/Update/Internal/Propagator.Evaluator.cs
// <summary>
// Supports propagation of preserve and unknown values when evaluating expressions. If any input
// to an expression is marked as unknown, the same is true of the result of evaluating
// that expression. If all inputs to an expression are marked 'preserve', then the result is also
// marked preserve.
// </summary>
// <param name="result"> Result to markup </param>
// <param name="inputs"> Expressions contributing to the result </param>
// <returns> Marked up result. </returns>
Supports propagation of preserve and unknown values when evaluating expressions. If any input
to an expression is marked as unknown, the same is true of the result of evaluating
that expression. If all inputs to an expression are marked 'preserve', then the result is also
marked preserve.
Supports propagation of preserve and unknown values when evaluating expressions . If any input to an expression is marked as unknown the same is true of the result of evaluating that expression . If all inputs to an expression are marked ' preserve ' then the result is also marked preserve .
private static PropagatorFlags PropagateUnknownAndPreserveFlags(PropagatorResult result, IEnumerable<PropagatorResult> inputs)
            {
                var unknown = false;
                var preserve = true;
                var noInputs = true;
                foreach (var input in inputs)
                {
                    noInputs = false;
                    var inputFlags = input.PropagatorFlags;
                    if (PropagatorFlags.NoFlags
                        != (PropagatorFlags.Unknown & inputFlags))
                    {
                        unknown = true;
                    }
                    if (PropagatorFlags.NoFlags
                        == (PropagatorFlags.Preserve & inputFlags))
                    {
                        preserve = false;
                    }
                }
                if (noInputs)
                {
                    preserve = false;
                }
                if (null != result)
                {
                    var flags = result.PropagatorFlags;
                    if (unknown)
                    {
                        flags |= PropagatorFlags.Unknown;
                    }
                    if (!preserve)
                    {
                        flags &= ~PropagatorFlags.Preserve;
                    }
                    return flags;
                }
                else
                {
                    var flags = PropagatorFlags.NoFlags;
                    if (unknown)
                    {
                        flags |= PropagatorFlags.Unknown;
                    }
                    if (preserve)
                    {
                        flags |= PropagatorFlags.Preserve;
                    }
                    return flags;
                }
            }
private static PropagatorFlags PropagateUnknownAndPreserveFlags ( PropagatorResult result , IEnumerable < PropagatorResult > inputs ) { var unknown = false ; var preserve = true ; var noInputs = true ; foreach ( var input in inputs ) { noInputs = false ; var inputFlags = input . PropagatorFlags ; if ( PropagatorFlags . NoFlags != ( PropagatorFlags . Unknown & inputFlags ) ) { unknown = true ; } if ( PropagatorFlags . NoFlags == ( PropagatorFlags . Preserve & inputFlags ) ) { preserve = false ; } } if ( noInputs ) { preserve = false ; } if ( null != result ) { var flags = result . PropagatorFlags ; if ( unknown ) { flags |= PropagatorFlags . Unknown ; } if ( ! preserve ) { flags &= ~ PropagatorFlags . Preserve ; } return flags ; } else { var flags = PropagatorFlags . NoFlags ; if ( unknown ) { flags |= PropagatorFlags . Unknown ; } if ( preserve ) { flags |= PropagatorFlags . Preserve ; } return flags ; } }
Supports propagation of preserve and unknown values when evaluating expressions.
Supports propagation of preserve and unknown values when evaluating expressions .
// aggregate all flags on the inputs // Merge with existing flags // if there is no input result, create new markup from scratch
Marked up result.
Marked up result .
result
PropagatorResult
Result to markup
Result to markup
inputs
IEnumerable<PropagatorResult>
Expressions contributing to the result
Expressions contributing to the result