/// <summary> /// Joins this instance with <paramref name="other"/>. /// </summary> /// <param name="other">The other container.</param> public bool Join(StrongReferenceContainer other) { if (other == null) { return(false); } if (!IsRoot) { root.Join(other); return(true); } if (!other.IsRoot) { throw new InvalidOperationException(); } other.root = this; if (lastJoinedContainer == null) { nextJoinedContainer = other; } else if (lastJoinedContainer.nextJoinedContainer != null) { throw new InvalidOperationException(); } else { lastJoinedContainer.nextJoinedContainer = other; } lastJoinedContainer = other.lastJoinedContainer ?? other; return(true); }
public void SaveStrongReference(EntityState reference) { if (referenceContainer == null) { referenceContainer = new StrongReferenceContainer(null); } _ = referenceContainer.Join(new StrongReferenceContainer(reference)); }