internal void MergeStreamDescriptor(StreamDescriptor materializedStreamDescriptor) { if (this.streamDescriptors == null) { this.streamDescriptors = new Dictionary <string, StreamDescriptor>(StringComparer.Ordinal); } StreamDescriptor descriptor = null; if (!this.streamDescriptors.TryGetValue(materializedStreamDescriptor.Name, out descriptor)) { this.streamDescriptors[materializedStreamDescriptor.Name] = materializedStreamDescriptor; materializedStreamDescriptor.EntityDescriptor = this; } else { StreamDescriptor.MergeStreamDescriptor(descriptor, materializedStreamDescriptor); } }
/// <summary> /// Merges the given named stream info object. /// If the stream descriptor is already present, then this method merges the info from the given stream descriptor /// into the existing one, otherwise justs add this given stream descriptor to the list of stream descriptors for /// this entity. /// </summary> /// <param name="materializedStreamDescriptor">namedStreamInfo instance containing information about the stream.</param> internal void MergeStreamDescriptor(StreamDescriptor materializedStreamDescriptor) { if (this.streamDescriptors == null) { this.streamDescriptors = new Dictionary <string, StreamDescriptor>(StringComparer.Ordinal); } StreamDescriptor existingStreamDescriptor = null; if (!this.streamDescriptors.TryGetValue(materializedStreamDescriptor.Name, out existingStreamDescriptor)) { this.streamDescriptors[materializedStreamDescriptor.Name] = materializedStreamDescriptor; materializedStreamDescriptor.EntityDescriptor = this; } else { StreamDescriptor.MergeStreamDescriptor(existingStreamDescriptor, materializedStreamDescriptor); Debug.Assert(ReferenceEquals(existingStreamDescriptor.EntityDescriptor, this), "All stream descriptors that are already tracked by the entity must point to the same entity descriptor instance"); } }