private void VerifyStoredProcedureChange(DeploymentPlanContributorContext context,
                                                 ModelComparisonChangeDefinition change)
        {
            var newProcedure = context.Source.GetObject(ModelSchema.Procedure, change.TargetObject.Name,
                                                        DacQueryScopes.UserDefined);
            var oldProcedure = context.Target.GetObject(ModelSchema.Procedure, change.TargetObject.Name,
                                                        DacQueryScopes.UserDefined);

            if (newProcedure == null)
            {
                return;
            }

            foreach (var parameter in  newProcedure.GetReferencedRelationshipInstances(Procedure.Parameters))
            {
                if (HasParameterBeenAddedWithoutDefaultValue(parameter, oldProcedure))
                {
                    //Severity.Error - fails the build process
                    Print(
                        string.Format(
                            "The procedure {0} has had an additional parameter but no default, parameter name: {1}",
                            change.TargetObject.Name, parameter.ObjectName), Severity.Error);
                }

                if (HasDefaultValueBeenRemoved(parameter, oldProcedure))
                {
                    Print(
                        string.Format("The procedure {0} has had a parameter default value removed, parameter name: {1}", change.TargetObject.Name, parameter.ObjectName), Severity.Error);
                }
            }

            foreach (var parameter in oldProcedure.GetReferencedRelationshipInstances(Procedure.Parameters))
            {
                if (HasParameterBeenRemoved(parameter, newProcedure))
                {
                    Print(
                        string.Format("The procedure {0} has had a parameter removed, parameter name: {1}",
                                      change.TargetObject.Name, parameter.ObjectName), Severity.Error);
                }
            }
        }
        private void VerifyStoredProcedureChange(DeploymentPlanContributorContext context,
            ModelComparisonChangeDefinition change)
        {
            var newProcedure = context.Source.GetObject(ModelSchema.Procedure, change.TargetObject.Name,
                DacQueryScopes.UserDefined);
            var oldProcedure = context.Target.GetObject(ModelSchema.Procedure, change.TargetObject.Name,
                DacQueryScopes.UserDefined);

            if (newProcedure == null)
                return;

            foreach (var parameter in  newProcedure.GetReferencedRelationshipInstances(Procedure.Parameters))
            {
                if (HasParameterBeenAddedWithoutDefaultValue(parameter, oldProcedure))
                {
                    //Severity.Error - fails the build process
                    Print(
                        string.Format(
                            "The procedure {0} has had an additional parameter but no default, parameter name: {1}",
                            change.TargetObject.Name, parameter.ObjectName), Severity.Error);
                }

                if (HasDefaultValueBeenRemoved(parameter, oldProcedure))
                {
                    Print(
                        string.Format("The procedure {0} has had a parameter default value removed, parameter name: {1}", change.TargetObject.Name, parameter.ObjectName), Severity.Error);
                }

            }

            foreach (var parameter in oldProcedure.GetReferencedRelationshipInstances(Procedure.Parameters))
            {
                if (HasParameterBeenRemoved(parameter, newProcedure))
                {
                    Print(
                        string.Format("The procedure {0} has had a parameter removed, parameter name: {1}",
                            change.TargetObject.Name, parameter.ObjectName), Severity.Error);
                }
            }
        }