public FakeBidirectionalRelationWorkUnit(FakeBidirectionalRelationWorkUnit original, IAuditWorkUnit nestedWorkUnit)
            : base(original.sessionImplementor, original.EntityName, original.verCfg, original.EntityId)
        {
            this.nestedWorkUnit = nestedWorkUnit;

            fakeRelationChanges = new Dictionary<String, FakeRelationChange>(original.getFakeRelationChanges());
        }
        public FakeBidirectionalRelationWorkUnit(FakeBidirectionalRelationWorkUnit original, IAuditWorkUnit nestedWorkUnit)
            : base(original.sessionImplementor, original.EntityName, original.verCfg, original.EntityId)
        {
            this.nestedWorkUnit = nestedWorkUnit;

            fakeRelationChanges = new Dictionary <String, FakeRelationChange>(original.getFakeRelationChanges());
        }
        public override IAuditWorkUnit Merge(FakeBidirectionalRelationWorkUnit second)
        {
            // First merging the nested work units.
            IAuditWorkUnit mergedNested = second.getNestedWorkUnit().Dispatch(nestedWorkUnit);

            // Now merging the fake relation changes from both work units.
            IDictionary <String, FakeRelationChange> secondFakeRelationChanges = second.getFakeRelationChanges();
            IDictionary <String, FakeRelationChange> mergedFakeRelationChanges = new Dictionary <String, FakeRelationChange>();
            //TODO Simon - decide if we use IESI.Collections in the end.
            ISet <String> allPropertyNames = new HashedSet <String>(fakeRelationChanges.Keys);

            allPropertyNames.AddAll(secondFakeRelationChanges.Keys);

            foreach (String propertyName in allPropertyNames)
            {
                mergedFakeRelationChanges.Add(propertyName,
                                              FakeRelationChange.Merge(
                                                  fakeRelationChanges[propertyName],
                                                  secondFakeRelationChanges[propertyName]));
            }

            return(new FakeBidirectionalRelationWorkUnit(this, mergedFakeRelationChanges, mergedNested));
        }
        public override IAuditWorkUnit Merge(FakeBidirectionalRelationWorkUnit second)
        {
            // First merging the nested work units.
            IAuditWorkUnit mergedNested = second.getNestedWorkUnit().Dispatch(nestedWorkUnit);

            // Now merging the fake relation changes from both work units.
            IDictionary<String, FakeRelationChange> secondFakeRelationChanges = second.getFakeRelationChanges();
            IDictionary<String, FakeRelationChange> mergedFakeRelationChanges = new Dictionary<String, FakeRelationChange>();
            //TODO Simon - decide if we use IESI.Collections in the end.
            ISet<String> allPropertyNames = new HashedSet<String>(fakeRelationChanges.Keys);
            allPropertyNames.AddAll(secondFakeRelationChanges.Keys);

            foreach (String propertyName in allPropertyNames) {
                mergedFakeRelationChanges.Add(propertyName,
                        FakeRelationChange.Merge(
                                fakeRelationChanges[propertyName],
                                secondFakeRelationChanges[propertyName]));
            }

            return new FakeBidirectionalRelationWorkUnit(this, mergedFakeRelationChanges, mergedNested);
        }