Esempio n. 1
0
        private void InterpretPastChanges(List <IModelChange> changes, BubbledChangeEventArgs currentEvent)
        {
            var r = currentEvent.Feature as IReference;

            if (r != null)
            {
                if (r.IsContainment)
                {
                    var change = EventToChange(currentEvent);
                    throw new NotImplementedException();
                }
                else if (r.Opposite != null && r.Opposite.IsContainment && r.UpperBound == 1)
                {
                    var change = EventToChange(currentEvent);
                    // last event created the item
                    var sourceChange = changes[changes.Count - 1];
                    var transaction  = new ElementaryChangeTransaction
                    {
                        AffectedElement = null,
                        SourceChange    = sourceChange
                    };
                    transaction.NestedChanges.Add(change);
                    changes[changes.Count - 1] = transaction;
                    return;
                }
            }
            throw new InvalidOperationException($"The {currentEvent.ChangeType} event of {currentEvent.Element} could not be interpreted because {currentEvent.Feature} is not a reference.");
        }
Esempio n. 2
0
        private static void CreateTransaction(List <IModelChange> changes, List <IModelChange> childChanges, IModelChange currentChange)
        {
            var transaction = new ElementaryChangeTransaction();

            transaction.SourceChange = currentChange;
            transaction.NestedChanges.AddRange(childChanges);
            changes.Add(transaction);
        }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ElementaryChangeTransactionReferencedElementsCollection(ElementaryChangeTransaction parent)
 {
     this._parent = parent;
 }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ElementaryChangeTransactionChildrenCollection(ElementaryChangeTransaction parent)
 {
     this._parent = parent;
 }