private void ChangeCreateIndexOperationalProps(DeploymentPlanContributorContext context, IList <IndexOption> options) { DeploymentStep nextStep = context.PlanHandle.Head; // Loop through all steps in the deployment plan bool foundMainSection = false; while (nextStep != null) { DeploymentStep currentStep = nextStep; nextStep = currentStep.Next; // We only want to analyze the main part of the deployment script - we'll skip // any steps until we pass the end of the predeployment section, and stop once // we hit the start of the postdeployment section if (currentStep is EndPreDeploymentScriptStep) { foundMainSection = true; continue; } if (!foundMainSection) { // Haven't gotten past predeployment yet continue; } if (currentStep is BeginPostDeploymentScriptStep) { break; } // We need to care about CreateElementSteps and AlterElementSteps for Indexes. DeploymentScriptDomStep domStep = currentStep as DeploymentScriptDomStep; TSqlObject elementObject = null; if (domStep is CreateElementStep) { elementObject = ((CreateElementStep)domStep).SourceElement; } else if (domStep is AlterElementStep) { elementObject = ((AlterElementStep)domStep).SourceElement; } if (elementObject != null) { if (Index.TypeClass.Equals(elementObject.ObjectType) && !(View.TypeClass.Equals(elementObject.GetParent().ObjectType))) { TSqlFragment fragment = domStep.Script; IndexStatementVisitor visitor = new IndexStatementVisitor(options); fragment.Accept(visitor); } } } }
private void ChangeCreateIndexOperationalProps(DeploymentPlanContributorContext context, IList<IndexOption> options) { DeploymentStep nextStep = context.PlanHandle.Head; // Loop through all steps in the deployment plan bool foundMainSection = false; while (nextStep != null) { DeploymentStep currentStep = nextStep; nextStep = currentStep.Next; // We only want to analyze the main part of the deployment script - we'll skip // any steps until we pass the end of the predeployment section, and stop once // we hit the start of the postdeployment section if (currentStep is EndPreDeploymentScriptStep) { foundMainSection = true; continue; } if (!foundMainSection) { // Haven't gotten past predeployment yet continue; } if (currentStep is BeginPostDeploymentScriptStep) { break; } // We need to care about CreateElementSteps and AlterElementSteps for Indexes. DeploymentScriptDomStep domStep = currentStep as DeploymentScriptDomStep; TSqlObject elementObject = null; if (domStep is CreateElementStep) { elementObject = ((CreateElementStep)domStep).SourceElement; } else if (domStep is AlterElementStep) { elementObject = ((AlterElementStep)domStep).SourceElement; } if (elementObject != null) { if (Index.TypeClass.Equals(elementObject.ObjectType) && !(View.TypeClass.Equals(elementObject.GetParent().ObjectType))) { TSqlFragment fragment = domStep.Script; IndexStatementVisitor visitor = new IndexStatementVisitor(options); fragment.Accept(visitor); } } } }