示例#1
0
        public override void Visit(SqlProcedureDefinition codeObject)
        {
            var createDefinition   = codeObject as SqlProcedureDefinitionForCreate;
            var isOrAlterStatement = createDefinition?.IsOrAlterStatement ?? false;
            var orAlter            = isOrAlterStatement ? " OR ALTER" : "";

            _stringBuilder.Append($"CREATE{orAlter} PROCEDURE ");

            codeObject.Name.Accept(this);

            using (_stringBuilder.CreateIndentationContext())
            {
                for (var i = 0; i < codeObject.Parameters.Count; i++)
                {
                    if (i > 0)
                    {
                        _stringBuilder.Append(",");
                    }

                    _stringBuilder.AppendIndentedLine();

                    codeObject.Parameters[i].Accept(this);
                }
            }

            _stringBuilder
            .AppendIndentedLine()
            .Append("AS");
        }
 internal SqlProcedureDefinitionFormatter(FormatterVisitor visitor, SqlProcedureDefinition codeObject)
     : base(visitor, codeObject, true)
 {
     NewLineSeparatedListFormatter = new NewLineSeparatedListFormatter(visitor, codeObject, false);
     foundTokenWith = false;
 }
 public override void Visit(SqlProcedureDefinition codeObject)
 {
     Format(codeObject);
 }