/// <summary> /// Adds a new entry into the dictionary for later postprocessing. /// </summary> /// <param name="relationshipDomainClassId">DomainClassId of the relationship.</param> /// <param name="relationshipId">Id of the relationship. Can be Guid.Empty, in which case a new relationship is created.</param> /// <param name="sourceId">Id of the source element. Can be Guid.Empty, in which case this entry needs to be updated later.</param> /// <param name="targetId">Id of the target element. Can be Guid.Empty, in which case this entry needs to be updated later.</param> public virtual void AddPostProcessData(Guid relationshipDomainClassId, Guid relationshipId, Guid sourceId, Guid targetId) { PostProcessRelationshipData p = new PostProcessRelationshipData(); p.RelationshipId = relationshipId; p.ModelElementSourceId = sourceId; p.ModelElementTargetId = targetId; if (!dictionary.Keys.Contains(relationshipDomainClassId)) { dictionary.Add(relationshipDomainClassId, new List<PostProcessRelationshipData>()); dictionary[relationshipDomainClassId].Add(p); } else { // check if there already is an entry and update it foreach(PostProcessRelationshipData data in dictionary[relationshipDomainClassId] ) if (data.RelationshipId == p.RelationshipId && p.RelationshipId != Guid.Empty) { // update if (data.ModelElementSourceId == Guid.Empty) data.ModelElementSourceId = sourceId; if (data.ModelElementTargetId == Guid.Empty) data.ModelElementTargetId = targetId; return; } dictionary[relationshipDomainClassId].Add(p); } }
/// <summary> /// Adds a new entry into the dictionary for later postprocessing. /// </summary> /// <param name="relationshipDomainClassId">DomainClassId of the relationship.</param> /// <param name="relationshipId">Id of the relationship. Can be Guid.Empty, in which case a new relationship is created.</param> /// <param name="sourceId">Id of the source element. Can be Guid.Empty, in which case this entry needs to be updated later.</param> /// <param name="targetId">Id of the target element. Can be Guid.Empty, in which case this entry needs to be updated later.</param> public virtual void AddPostProcessData(Guid relationshipDomainClassId, Guid relationshipId, Guid sourceId, Guid targetId) { PostProcessRelationshipData p = new PostProcessRelationshipData(); p.RelationshipId = relationshipId; p.ModelElementSourceId = sourceId; p.ModelElementTargetId = targetId; if (!dictionary.Keys.Contains(relationshipDomainClassId)) { dictionary.Add(relationshipDomainClassId, new List <PostProcessRelationshipData>()); dictionary[relationshipDomainClassId].Add(p); } else { // check if there already is an entry and update it foreach (PostProcessRelationshipData data in dictionary[relationshipDomainClassId]) { if (data.RelationshipId == p.RelationshipId && p.RelationshipId != Guid.Empty) { // update if (data.ModelElementSourceId == Guid.Empty) { data.ModelElementSourceId = sourceId; } if (data.ModelElementTargetId == Guid.Empty) { data.ModelElementTargetId = targetId; } return; } } dictionary[relationshipDomainClassId].Add(p); } }