private void RetrieveResultMarkup(PropagatorResult source) { Debug.Assert(null != source); if (source.Identifier != PropagatorResult.NullIdentifier) { // state entries travel with identifiers. several state entries may be merged // into a single identifier result via joins in the update mapping view do { if (null != source.StateEntry) { m_stateEntries.Add(source.StateEntry); if (source.Identifier != PropagatorResult.NullIdentifier) { // if this is an identifier, it may also be registered with an "owner". // Return the owner as well if the owner is also mapped to this table. PropagatorResult owner; if (m_translator.KeyManager.TryGetIdentifierOwner(source.Identifier, out owner) && null != owner.StateEntry && ExtentInScope(owner.StateEntry.EntitySet)) { m_stateEntries.Add(owner.StateEntry); } // Check if are any referential constraints. If so, the entity key // implies that the dependent relationship instance is also being // handled in this result. foreach (IEntityStateEntry stateEntry in m_translator.KeyManager.GetDependentStateEntries(source.Identifier)) { m_stateEntries.Add(stateEntry); } } } source = source.Next; }while (null != source); } else if (!source.IsSimple && !source.IsNull) { // walk children foreach (PropagatorResult child in source.GetMemberValues()) { RetrieveResultMarkup(child); } } }
private void AddReferencedEntities(UpdateTranslator translator, PropagatorResult result, KeyToListMap <EntityKey, UpdateCommand> referencedEntities) { foreach (PropagatorResult property in result.GetMemberValues()) { if (property.IsSimple && property.Identifier != PropagatorResult.NullIdentifier && (PropagatorFlags.ForeignKey == (property.PropagatorFlags & PropagatorFlags.ForeignKey))) { foreach (int principal in translator.KeyManager.GetDirectReferences(property.Identifier)) { PropagatorResult owner; if (translator.KeyManager.TryGetIdentifierOwner(principal, out owner) && null != owner.StateEntry) { Debug.Assert(!owner.StateEntry.IsRelationship, "owner must not be a relationship"); referencedEntities.Add(owner.StateEntry.EntityKey, this); } } } } }
private void RetrieveResultMarkup(PropagatorResult source) { Debug.Assert(null != source); if (source.Identifier != PropagatorResult.NullIdentifier) { // state entries travel with identifiers. several state entries may be merged // into a single identifier result via joins in the update mapping view do { if (null != source.StateEntry) { m_stateEntries.Add(source.StateEntry); if (source.Identifier != PropagatorResult.NullIdentifier) { // if this is an identifier, it may also be registered with an "owner". // Return the owner as well if the owner is also mapped to this table. PropagatorResult owner; if (m_translator.KeyManager.TryGetIdentifierOwner(source.Identifier, out owner) && null != owner.StateEntry && ExtentInScope(owner.StateEntry.EntitySet)) { m_stateEntries.Add(owner.StateEntry); } // Check if are any referential constraints. If so, the entity key // implies that the dependent relationship instance is also being // handled in this result. foreach (var stateEntry in m_translator.KeyManager.GetDependentStateEntries(source.Identifier)) { m_stateEntries.Add(stateEntry); } } } source = source.Next; } while (null != source); } else if (!source.IsSimple && !source.IsNull) { // walk children foreach (var child in source.GetMemberValues()) { RetrieveResultMarkup(child); } } }