コード例 #1
0
        /// <summary>
        /// Direct commit of data is appended on the existing nodes
        /// </summary>
        /// <param name="changeSet">Changes</param>
        private void CommitDirect(AppendableChangeSet <Guid, object, EdgeData> changeSet)
        {
            // Add all nodes to the provider
            foreach (Guid nodeId in changeSet.Nodes.EnumerateNodes())
            {
                var node = changeSet.Nodes.GetNode(nodeId, NodeAccess.Read);
                nodes.SetNode(nodeId, node);
            }

            // Store the change set in the change set provider
            changeSetProvider.SetChangeSet(changeSet);

            // Calculate collected nodes in the source changeset
            collectedNodesProvider.StoreChangeset(changeSet, mutableParentProvider, immutableParentProvider);

            // Update parent information in the parent map provider
            mutableParentProvider.UpdateParents(changeSet, collectedNodesProvider);

            // Update parent information in the immutable parent map provider
            immutableParentProvider.UpdateParents(changeSet, collectedNodesProvider);

            // Add new snapshot making it visible
            snapshotsService.AddSnapshot(changeSet.DestinationSnapshotId);

#if DEBUG
            Debug.WriteLine("Created snapshot " + changeSet.DestinationSnapshotId);

            Utils.LogNodesRecursive(changeSet.DestinationSnapshotId, nodes, changeSet.Nodes, 0, new Hashtable(), typesService);

            Debug.WriteLine("---------------------------------------------");

            Debug.WriteLine("Collected nodes are:");

            var enumerator = collectedNodesProvider.GetEdges(changeSet.SourceSnapshotId);

            if (enumerator != null)
            {
                using (enumerator)
                {
                    while (enumerator.MoveNext())
                    {
                        Debug.WriteLine(enumerator.Current.ToNodeId);
                    }
                }
            }

            Debug.WriteLine("---------------------------------------------");
#endif
        }