コード例 #1
0
        private string GetActualPath(string oldNodePath)
        {
            Node actualNode;

            return(TemporaryRenames.TryGetValue(oldNodePath, out actualNode)
        ? actualNode.Path : oldNodePath);
        }
コード例 #2
0
        private void UpdateHints()
        {
            var originalHints = Hints;

            Hints = new HintSet(CurrentModel, TargetModel);

            // Process RenameHints
            foreach (var renameHint in originalHints.OfType <RenameHint>())
            {
                if (TemporaryRenames.TryGetValue(renameHint.SourcePath, out var sourceNode))
                {
                    Hints.Add(new RenameHint(sourceNode.Path, renameHint.TargetPath));
                }
                else
                {
                    Hints.Add(renameHint);
                }
            }

            // Process CopyDataHints
            foreach (var copyDataHint in originalHints.OfType <CopyDataHint>())
            {
                var sourceTablePath = GetActualPath(copyDataHint.SourceTablePath);
                var identities      = copyDataHint.Identities.Select(pair =>
                                                                     new IdentityPair(GetActualPath(pair.Source), pair.Target, pair.IsIdentifiedByConstant))
                                      .ToList();
                var copiedColumns = copyDataHint.CopiedColumns.Select(pair =>
                                                                      new Pair <string>(GetActualPath(pair.First), pair.Second))
                                    .ToList();
                var newCopyDataHint = new CopyDataHint(sourceTablePath, identities, copiedColumns);
                Hints.Add(newCopyDataHint);
            }

            // Process DeleteDataHints
            foreach (var deleteDataHint in originalHints.OfType <DeleteDataHint>())
            {
                if (!deleteDataHint.PostCopy)
                {
                    continue; // It's not necessary to copy this hint
                }

                var sourceTablePath = GetActualPath(deleteDataHint.SourceTablePath);
                var identities      = deleteDataHint.Identities.Select(pair =>
                                                                       new IdentityPair(GetActualPath(pair.Source), pair.Target, pair.IsIdentifiedByConstant))
                                      .ToList();
                var newDeleteDataHint = new DeleteDataHint(sourceTablePath, identities, true);
                Hints.Add(newDeleteDataHint);
            }

            // Process IgnoreHints
            foreach (var ignoreHint in originalHints.OfType <IgnoreHint>())
            {
                Hints.Add(ignoreHint);
            }
        }
コード例 #3
0
 private string GetActualPath(string oldNodePath) =>
 TemporaryRenames.TryGetValue(oldNodePath, out var actualNode)
 ? actualNode.Path : oldNodePath;