예제 #1
0
        protected override void Process([NotNull] ReinstallArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            IEnumerable <Database> detectedDatabases = args.InstanceDatabases;
            string rootPath                = args.RootPath.ToLower();
            var    connectionString        = args.ConnectionString;
            string instanceName            = args.InstanceName;
            IPipelineController controller = this.Controller;

            DeleteDatabasesHelper.Process(detectedDatabases, rootPath, connectionString, instanceName, controller, this.done);

            if (controller != null)
            {
                controller.IncrementProgress(args.InstanceDatabases.Count - 1);
            }
        }
        private static bool ExecuteProcessors([NotNull] ProcessorArgs args, [NotNull] IEnumerable <Processor> processorList, [CanBeNull] IPipelineController controller = null, bool startThisAndNestedProcessors = true)
        {
            Assert.ArgumentNotNull(args, nameof(args));
            Assert.ArgumentNotNull(processorList, nameof(processorList));

            using (new ProfileSection("Execute pipeline processors"))
            {
                ProfileSection.Argument("args", args);
                ProfileSection.Argument("processorList", processorList);
                ProfileSection.Argument("controller", controller);
                ProfileSection.Argument("startThisAndNestedProcessors", startThisAndNestedProcessors);

                bool result = startThisAndNestedProcessors;
                foreach (Processor processor in processorList)
                {
                    bool processorResult = startThisAndNestedProcessors;

                    if (processorResult)
                    {
                        processorResult = processor.Execute(args);
                    }
                    else
                    {
                        processor.Skip();
                    }

                    if (controller != null)
                    {
                        controller.IncrementProgress();
                    }

                    // Process nested steps
                    result &= ExecuteProcessors(args, processor._NestedProcessors, controller, processorResult);
                }

                return(ProfileSection.Result(result));
            }
        }