src/Shared/EntityFramework/Core/Mapping/Update/Internal/KeyManager.cs
// <summary>
// Given a value, returns the value for its principal owner.
// </summary>
Given a value, returns the value for its principal owner.
Given a value returns the value for its principal owner .
internal object GetPrincipalValue(PropagatorResult result)
        {
            var currentIdentifier = result.Identifier;
            if (PropagatorResult.NullIdentifier == currentIdentifier)
            {
                return result.GetSimpleValue();
            }
            var first = true;
            object value = null;
            foreach (var principal in GetPrincipals(currentIdentifier))
            {
                var ownerResult = _identifiers[principal].Owner;
                if (null != ownerResult)
                {
                    if (first)
                    {
                        value = ownerResult.GetSimpleValue();
                        first = false;
                    }
                    else
                    {
                        if (!ByValueEqualityComparer.Default.Equals(value, ownerResult.GetSimpleValue()))
                        {
                            throw new ConstraintException(Strings.Update_ReferentialConstraintIntegrityViolation);
                        }
                    }
                }
            }
            if (first)
            {
                value = result.GetSimpleValue();
            }
            return value;
        }
internal object GetPrincipalValue ( PropagatorResult result ) { var currentIdentifier = result . Identifier ; if ( PropagatorResult . NullIdentifier == currentIdentifier ) { return result . GetSimpleValue ( ) ; } var first = true ; object value = null ; foreach ( var principal in GetPrincipals ( currentIdentifier ) ) { var ownerResult = _identifiers [ principal ] . Owner ; if ( null != ownerResult ) { if ( first ) { value = ownerResult . GetSimpleValue ( ) ; first = false ; } else { if ( ! ByValueEqualityComparer . Default . Equals ( value , ownerResult . GetSimpleValue ( ) ) ) { throw new ConstraintException ( Strings . Update_ReferentialConstraintIntegrityViolation ) ; } } } } if ( first ) { value = result . GetSimpleValue ( ) ; } return value ; }
Given a value, returns the value for its principal owner.
Given a value returns the value for its principal owner .
// for non-identifiers, there is nothing to resolve // find principals for this value // result is taken from the first principal // subsequent results are validated for consistency with the first // if there are no principals, return the current value directly
result
PropagatorResult