Show / Hide Table of Contents

Class ParameterSubstitution

Class for substituting @-prefixed parameters with their values

Inheritance
System.Object
ParameterSubstitution
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public class ParameterSubstitution : IEnumerable<KeyValuePair<string, object>>, IEnumerable
Remarks

This class will substitute values into an AML template. Using this class to perform the substitution (via creating a Command) provides several benefits over other techniques (e.g. System.String.Format(System.String,System.Object[]))

String values will be properly escaped for AML.For example, Items 1 & 2 are > Item 3 will be encoded as Items 1 &amp; 2 are &gt; Item 3. If you don't want this to happen, add an exclamation mark after your parameter name (e.g. using &quot;&lt;prop>@0</prop>" will encode the string while using &quot;&lt;prop>@0!</prop>" will not perform any encoding
Basic .Net types will be handled properlyFor example, true will be encoded as 1 and new DateTime(2000, 1, 1) will be encoded as 2000-01-01T00:00:00

Parameters can appear in AML attributes, elements, or in SQL strings. Since AML attributes always are surrounded by quotes, be sure to put your parameter name in quotes as well (whether they are single quotes or double quotes). In SQL, parameters are not quoted as not all values need to be quoted. Rather, the replacement process will decide whether or not quotes are needed. For example,

<Item type='Part' action='@0'>
  <state condition='in'>(select name from innovator.table where id = @1)</state>
</Item>

Constructors

| Improve this Doc View Source

ParameterSubstitution()

Initializes a new ParameterSubstitution instance for substituting @-prefixed parameters with their values.

Declaration
public ParameterSubstitution()
Remarks

A new instance should be created for each substitution operation

Properties

| Improve this Doc View Source

ItemCount

Gets the number of Item tags found in the query

Declaration
public int ItemCount { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

Mode

Whether the query is AML or SQL

Declaration
public ParameterSubstitutionMode Mode { get; set; }
Property Value
Type Description
ParameterSubstitutionMode
| Improve this Doc View Source

ParamCount

Gets the number of parameters for which values were specified

Declaration
public int ParamCount { get; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

ParameterAccessListener

Gets or sets a callback function which will be called when a parameter is accessed

Declaration
public Action<string> ParameterAccessListener { get; set; }
Property Value
Type Description
System.Action<System.String>
| Improve this Doc View Source

Style

Gets or sets the style of parameters being used

Declaration
public ParameterStyle Style { get; set; }
Property Value
Type Description
ParameterStyle

Methods

| Improve this Doc View Source

AddIndexedParameters(Object[])

Adds the array of values as parameters where each value is named according to its index in the arra

Declaration
public void AddIndexedParameters(object[] values)
Parameters
Type Name Description
System.Object[] values

The array of values.

| Improve this Doc View Source

AddParameter(String, Object)

Adds the parameter.

Declaration
public void AddParameter(string name, object value)
Parameters
Type Name Description
System.String name

The name of the parameter.

System.Object value

The value of the parameter.

| Improve this Doc View Source

ClearParameters()

Clears the parameters.

Declaration
public void ClearParameters()
| Improve this Doc View Source

GetEnumerator()

Returns an enumerator that iterates through the list of parameters

Declaration
public IEnumerator<KeyValuePair<string, object>> GetEnumerator()
Returns
Type Description
System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<System.String, System.Object>>

A System.Collections.Generic.IEnumerator<T> that can be used to iterate through the collection.

Implements
System.Collections.Generic.IEnumerable<T>.GetEnumerator()
| Improve this Doc View Source

Substitute(String, IServerContext)

Substitutes the stored parameters into the specified query.

Declaration
public string Substitute(string query, IServerContext context)
Parameters
Type Name Description
System.String query

The query.

IServerContext context

The context.

Returns
Type Description
System.String

A string of the new query

| Improve this Doc View Source

Substitute(String, IServerContext, TextWriter)

Substitutes the stored parameters into the specified query.

Declaration
public void Substitute(string query, IServerContext context, TextWriter writer)
Parameters
Type Name Description
System.String query

The query.

IServerContext context

The context.

System.IO.TextWriter writer

System.IO.TextWriter into which the new query is written

| Improve this Doc View Source

Substitute(String, IServerContext, StringBuilder)

Substitutes the stored parameters into the specified query.

Declaration
public void Substitute(string query, IServerContext context, StringBuilder builder)
Parameters
Type Name Description
System.String query

The query.

IServerContext context

The context.

System.Text.StringBuilder builder

System.Text.StringBuilder into which the new query is written

| Improve this Doc View Source

Substitute(String, IServerContext, XmlWriter)

Substitutes the stored parameters into the specified query.

Declaration
public void Substitute(string query, IServerContext context, XmlWriter writer)
Parameters
Type Name Description
System.String query

The query.

IServerContext context

The context.

System.Xml.XmlWriter writer

System.Xml.XmlWriter into which the new query is written

Explicit Interface Implementations

| Improve this Doc View Source

IEnumerable.GetEnumerator()

Declaration
IEnumerator IEnumerable.GetEnumerator()
Returns
Type Description
System.Collections.IEnumerator
Implements
System.Collections.IEnumerable.GetEnumerator()

Extension Methods

Extensions.GroupConcat<T>(IEnumerable<T>, String, Func<T, String>)
  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX