Exemplo 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 ChangeTransaction
                    {
                        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.");
        }
Exemplo n.º 2
0
        private static void CreateTransaction(List <IModelChange> changes, List <IModelChange> childChanges, IModelChange currentChange)
        {
            var transaction = new ChangeTransaction();

            transaction.SourceChange = currentChange;
            transaction.NestedChanges.AddRange(childChanges);
            changes.Add(transaction);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ChangeTransactionReferencedElementsCollection(ChangeTransaction parent)
 {
     this._parent = parent;
 }
Exemplo n.º 4
0
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ChangeTransactionChildrenCollection(ChangeTransaction parent)
 {
     this._parent = parent;
 }