private void RetrieveResultMarkup(PropagatorResult source) { DebugCheck.NotNull(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); } } }
private void AddReferencedEntities( UpdateTranslator translator, PropagatorResult result, KeyToListMap <EntityKey, UpdateCommand> referencedEntities) { foreach (PropagatorResult memberValue in result.GetMemberValues()) { if (memberValue.IsSimple && memberValue.Identifier != -1 && PropagatorFlags.ForeignKey == (memberValue.PropagatorFlags & PropagatorFlags.ForeignKey)) { foreach (int directReference in translator.KeyManager.GetDirectReferences(memberValue.Identifier)) { PropagatorResult owner; if (translator.KeyManager.TryGetIdentifierOwner(directReference, out owner) && owner.StateEntry != null) { referencedEntities.Add(owner.StateEntry.EntityKey, this); } } } } }
private void RetrieveResultMarkup(PropagatorResult source) { if (source.Identifier != -1) { do { if (source.StateEntry != null) { this.m_stateEntries.Add(source.StateEntry); if (source.Identifier != -1) { PropagatorResult owner; if (this.m_translator.KeyManager.TryGetIdentifierOwner(source.Identifier, out owner) && owner.StateEntry != null && this.ExtentInScope(owner.StateEntry.EntitySet)) { this.m_stateEntries.Add(owner.StateEntry); } foreach (IEntityStateEntry dependentStateEntry in this.m_translator.KeyManager.GetDependentStateEntries(source.Identifier)) { this.m_stateEntries.Add(dependentStateEntry); } } } source = source.Next; }while (source != null); } else { if (source.IsSimple || source.IsNull) { return; } foreach (PropagatorResult memberValue in source.GetMemberValues()) { this.RetrieveResultMarkup(memberValue); } } }
private void AddReferencedEntities( UpdateTranslator translator, PropagatorResult result, KeyToListMap <EntityKey, UpdateCommand> referencedEntities) { foreach (var property in result.GetMemberValues()) { if (property.IsSimple && property.Identifier != PropagatorResult.NullIdentifier && (PropagatorFlags.ForeignKey == (property.PropagatorFlags & PropagatorFlags.ForeignKey))) { foreach (var 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) { DebugCheck.NotNull(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); } } }