Beispiel #1
0
        /// <summary>
        /// Formats an AML string by substituting the @0 style parameters with the
        /// arguments specified.
        /// </summary>
        /// <param name="format">Query to format</param>
        /// <param name="args">Arguments to substitute into the query</param>
        public string FormatAml(string format, params object[] args)
        {
            var sub = new ParameterSubstitution();

            sub.AddIndexedParameters(args);
            return(sub.Substitute(format, LocalizationContext));
        }
Beispiel #2
0
        /// <summary>Append the specified command with parameters the SQL. @# (e.g. @0) style
        /// parameters are replaced</summary>
        /// <remarks>Depending on the number of commands written and the <see cref="Threshold"/>, the
        /// buffer of SQL commands might be sent to the server after this call. See
        /// <see cref="Innovator.Client.Command"/> and <see cref="ParameterSubstitution"/> for more
        /// information on how parameters are substituted</remarks>
        public SqlBatchWriter Command(string format, params object[] args)
        {
            _subs.AddIndexedParameters(args);
            var value = _subs.Substitute(format, _aml.LocalizationContext);

            if (_conn == null)
            {
                _builder.AppendLine(value);
            }
            else
            {
                _builder.AppendEscapedXml(value).AppendLine();
                ProcessCommand(false);
            }
            _subs.ClearParameters();
            return(this);
        }
Beispiel #3
0
 /// <summary>
 /// Return a result from an AML string by substituting the @0 style parameters
 /// with the arguments specified.
 /// </summary>
 /// <param name="xml">Query to format</param>
 /// <param name="args">Arguments to substitute into the query</param>
 public IResult FromXml(string xml, params object[] args)
 {
     using (var writer = new ResultWriter(this, null, null, false))
     {
         var sub = new ParameterSubstitution();
         sub.AddIndexedParameters(args);
         sub.Substitute(xml, LocalizationContext, writer);
         return(writer.Result);
     }
 }
Beispiel #4
0
 /// <summary>
 /// <a href="https://en.wikipedia.org/wiki/Fluent_interface">Fluent</a> interface used to
 /// specify the AML of the request.  SQL Server style numbered AML parameters (used as
 /// attribute and element values) are replaced with the corresponding arguments. Property type
 /// conversion and XML formatting is performed
 /// </summary>
 /// <param name="query">Format string containing the parameters</param>
 /// <param name="args">Replacement values for the numbered parameters</param>
 /// <returns>The current command for chaining additional method calls</returns>
 public Command WithAml(string query, params object[] args)
 {
     this.Aml = query;
     _sub.AddIndexedParameters(args);
     return(this);
 }