示例#1
0
        private Dictionary <string, string> CloneAffectedSolutions(List <Solution> affectedSuperSolutions)
        {
            var mappingsWithBackpus = new Dictionary <string, string>();

            try
            {
                foreach (var item in affectedSuperSolutions)
                {
                    mappingsWithBackpus.Add(item.UniqueName, string.Format("{0}_backup", item.UniqueName));
                    CurrentSolutionManager
                    .CloneSolution(
                        item.Id,
                        mappingsWithBackpus[item.UniqueName],
                        mappingsWithBackpus[item.UniqueName],
                        item.Version,
                        item.Description);
                }
            }
            catch (Exception)
            {
                UpdateDialogMessage($"Rolling back cloning solutions...");
                foreach (var keyValue in mappingsWithBackpus)
                {
                    var originalSolution = keyValue.Key;
                    var clonedVersion    = keyValue.Value;
                    CurrentSolutionManager.RemoveSolution(clonedVersion);
                }
                throw;
            }

            return(mappingsWithBackpus);
        }