private void ChangeNewDatabaseLocation(DeploymentPlanContributorContext context, string databasePath,
                                               string logPath)
        {
            DeploymentStep nextStep = context.PlanHandle.Head;

            // Loop through all steps in the deployment plan
            bool finished = false;

            while (nextStep != null && !finished)
            {
                // Increment the step pointer, saving both the current and next steps
                DeploymentStep currentStep = nextStep;

                // Only interrogate up to BeginPreDeploymentScriptStep - setvars must be done before that
                if (currentStep is BeginPreDeploymentScriptStep)
                {
                    finished = true;
                    break;
                }

                SqlCreateDatabaseStep createDbStep = currentStep as SqlCreateDatabaseStep;
                if (createDbStep != null)
                {
                    TSqlFragment fragment = createDbStep.Script;

                    CreateDatabaseStatementVisitor visitor = new CreateDatabaseStatementVisitor(databasePath, logPath);
                    fragment.Accept(visitor);

                    finished = true;
                }

                nextStep = currentStep.Next;
            }
        }
        /// <summary>
        ///     Sets the database location.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <param name="mdfFilePath">The MDF file path.</param>
        /// <param name="ldfFilePath">The LDF file path.</param>
        private void SetDatabaseLocation(DeploymentPlanContributorContext context, string mdfFilePath, string ldfFilePath)
        {
            DeploymentStep nextStep = context.PlanHandle.Head;

            /////
            // Loop through all steps in the deployment plan
            /////
            bool finished = false;

            while (nextStep != null && !finished)
            {
                DeploymentStep currentStep = nextStep;

                /////
                // Only interrogate up to BeginPreDeploymentScriptStep
                /////
                if (currentStep is BeginPreDeploymentScriptStep)
                {
                    break;
                }

                var createDbStep = currentStep as SqlCreateDatabaseStep;

                if (createDbStep != null)
                {
                    TSqlFragment fragment = createDbStep.Script;

                    var visitor = new CreateDatabaseStatementVisitor(mdfFilePath, ldfFilePath);

                    fragment.Accept(visitor);

                    finished = true;
                }

                nextStep = currentStep.Next;
            }
        }
        private void ChangeNewDatabaseLocation(DeploymentPlanContributorContext context, string databasePath,
            string logPath)
        {
            DeploymentStep nextStep = context.PlanHandle.Head;

            // Loop through all steps in the deployment plan
            bool finished = false;
            while (nextStep != null && !finished)
            {
                // Increment the step pointer, saving both the current and next steps
                DeploymentStep currentStep = nextStep;

                // Only interrogate up to BeginPreDeploymentScriptStep - setvars must be done before that
                if (currentStep is BeginPreDeploymentScriptStep)
                {
                    finished = true;
                    break;
                }

                SqlCreateDatabaseStep createDbStep = currentStep as SqlCreateDatabaseStep;
                if (createDbStep != null)
                {
                    TSqlFragment fragment = createDbStep.Script;

                    CreateDatabaseStatementVisitor visitor = new CreateDatabaseStatementVisitor(databasePath, logPath);
                    fragment.Accept(visitor);

                    finished = true;
                }

                nextStep = currentStep.Next;
            }
        }