Show / Hide Table of Contents

Class Command

An AML request to be submitted to the server

Inheritance
System.Object
Command
UploadCommand
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)
Namespace: Innovator.Client
Assembly: Innovator.Client.dll
Syntax
public class Command
Remarks

In most situations, you should never need to interact with the Command class directly since a System.String is implicitly promoted to a Command. For example, with the Apply(IConnection, Command, Object[]), you can use code similar to

// Get preliminary parts which have existed for a little bit of time
var components = conn.Apply(@"<Item type='Part' action='get'>
  <classification>@0</classification>
  <created_on condition='lt'>@1</created_on>
  <state>Preliminary</state>
</Item>", classification, DateTime.Now.AddMinutes(-20)).Items();

Behind the scenes, this is equivalent to the code

// Get preliminary parts which have existed for a little bit of time
var components = conn.Apply(new Command(@"<Item type='Part' action='get'>
  <classification>@0</classification>
  <created_on condition='lt'>@1</created_on>
  <state>Preliminary</state>
</Item>", classification, DateTime.Now.AddMinutes(-20))).Items();

So why would you need to create a Command? Perhaps, you need to specify the SOAP action to use

var cmd = new Command(@"<AML>
  <Item type = 'Part' action='get' id='30F66F086BDE4032B29034FC7D84A99D' />
  <Item type = 'Part' action='get' id='3F292E347CC64FB698C58E010364537E' />
</AML>").WithAction(CommandAction.ApplyAML);
var parts = conn.Apply(cmd).Items();

Or, you would rather use named parameters instead of numbered parameters

// Get preliminary parts which have existed for a little bit of time
var components = conn.Apply(new Command(@"<Item type='Part' action='get'>
  <classification>@class</classification>
  <created_on condition='lt'>@created</created_on>
  <state>Preliminary</state>
</Item>")
  .WithParam("class", classification)
  .WithParam("created", DateTime.Now.AddMinutes(-20))).Items();

For more information on how parameter substitution works see ParameterSubstitution. For other ways to create AML, see ElementFactory

Constructors

| Improve this Doc View Source

Command()

Instantiate a new command

Declaration
public Command()
| Improve this Doc View Source

Command(IAmlNode)

Creates an AML command that will be sent to the server from an IAmlNode

Declaration
public Command(IAmlNode aml)
Parameters
Type Name Description
IAmlNode aml

The AML object (e.g. IReadOnlyItem) that you want to create the command with

| Improve this Doc View Source

Command(IEnumerable<IAmlNode>)

Creates an AML command that will be sent to the server from an System.Collections.Generic.IEnumerable<T>

Declaration
public Command(IEnumerable<IAmlNode> aml)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<IAmlNode> aml

System.Collections.Generic.IEnumerable<T> that you want to create the command with

| Improve this Doc View Source

Command(String, Object[])

Creates an AML command that will be sent to the server. Numbered AML parameters (e.g. @0, used as attribute and element values) will be replaced with the corresponding arguments.

Declaration
public Command(string query, params object[] args)
Parameters
Type Name Description
System.String query

Query string containing the parameters

System.Object[] args

Replacement values for the numbered parameters

Remarks

Property type conversion and XML formatting is performed

Properties

| Improve this Doc View Source

Action

SOAP action to use with the AML

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

ActionString

SOAP action to use with the AML (represented as a string)

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

Aml

The AML query

Declaration
public virtual string Aml { get; set; }
Property Value
Type Description
System.String
| Improve this Doc View Source

LogListener

Gets or sets the delegate which will be called when a log item is written pertaining to this request.

Declaration
public Action<int, string, IEnumerable<KeyValuePair<string, object>>> LogListener { get; set; }
Property Value
Type Description
System.Action<System.Int32, System.String, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Object>>>

The delegate which will be called when a log item is written pertaining to this request.

Remarks

The arguments to the delegate are

ValueDescription
System.Int32: Log LevelIndicates the severity of the message. Always 4 to indiate an informational message
System.String: MessageThe text of the message
System.Collections.Generic.IEnumerable<T>: ParametersStructured parameters which contain useful log data

| Improve this Doc View Source

Parameters

Gets the parameters.

Declaration
public IEnumerable<KeyValuePair<string, object>> Parameters { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Object>>

The parameters.

| Improve this Doc View Source

Settings

Specify a method to configure each outgoing HTTP request associated specifically with this AML request

Declaration
public Action<IHttpRequest> Settings { get; set; }
Property Value
Type Description
System.Action<IHttpRequest>

Methods

| Improve this Doc View Source

AddAml(String)

Append a query to this request

Declaration
protected virtual void AddAml(string query)
Parameters
Type Name Description
System.String query

Query to append

| Improve this Doc View Source

ToNormalizedAml(IServerContext)

Perform parameter substitutions and return the resulting AML

Declaration
public string ToNormalizedAml(IServerContext context)
Parameters
Type Name Description
IServerContext context

Localization context (e.g. from LocalizationContext)

Returns
Type Description
System.String

AML string

| Improve this Doc View Source

ToNormalizedAml(IServerContext, TextWriter)

Perform parameter substitutions and return the resulting AML

Declaration
public void ToNormalizedAml(IServerContext context, TextWriter writer)
Parameters
Type Name Description
IServerContext context

Localization context (e.g. from LocalizationContext)

System.IO.TextWriter writer

Writer to which AML is written

| Improve this Doc View Source

ToNormalizedAml(IServerContext, XmlWriter)

Perform parameter substitutions and return the resulting AML

Declaration
public void ToNormalizedAml(IServerContext context, XmlWriter writer)
Parameters
Type Name Description
IServerContext context

Localization context (e.g. from LocalizationContext)

System.Xml.XmlWriter writer

Writer to which AML is written

| Improve this Doc View Source

ToString()

Return the AML string

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()
| Improve this Doc View Source

WithAction(CommandAction)

Fluent interface used to specify the SOAP action to use with the AML

Declaration
public Command WithAction(CommandAction action)
Parameters
Type Name Description
CommandAction action

The SOAP action to send with the AML

Returns
Type Description
Command

The current command for chaining additional method calls

| Improve this Doc View Source

WithAction(String)

Fluent interface used to specify the SOAP action to use with the AML (as a string)

Declaration
public Command WithAction(string action)
Parameters
Type Name Description
System.String action

The SOAP action to send with the AML

Returns
Type Description
Command

The current command for chaining additional method calls

| Improve this Doc View Source

WithAml(String, Object[])

Fluent 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

Declaration
public Command WithAml(string query, params object[] args)
Parameters
Type Name Description
System.String query

Format string containing the parameters

System.Object[] args

Replacement values for the numbered parameters

Returns
Type Description
Command

The current command for chaining additional method calls

| Improve this Doc View Source

WithLogListener(Action<Int32, String, IEnumerable<KeyValuePair<String, Object>>>)

Fluent interface used to specify a log listener to be called when logging data is recorded during the execution of this command

Declaration
public Command WithLogListener(Action<int, string, IEnumerable<KeyValuePair<string, object>>> listener)
Parameters
Type Name Description
System.Action<System.Int32, System.String, System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.String, System.Object>>> listener

Callback to handle the logging of information. The parameters include the message level, message, and any relevant structured data

Returns
Type Description
Command

The current command for chaining additional method calls

| Improve this Doc View Source

WithParam(String, Object)

Specify a named parameter and its value

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

Parameter name

System.Object value

Parameter value

Returns
Type Description
Command

Operators

| Improve this Doc View Source

Implicit(String to Command)

Implicitly convert strings to commands as needed

Declaration
public static implicit operator Command(string aml)
Parameters
Type Name Description
System.String aml
Returns
Type Description
Command
| Improve this Doc View Source

Implicit(XElement to Command)

Implicitly convert XML elements to commands as needed

Declaration
public static implicit operator Command(XElement aml)
Parameters
Type Name Description
System.Xml.Linq.XElement aml
Returns
Type Description
Command

Extension Methods

ItemExtensions.ToNormalizedAml(Command, ElementFactory)

See Also

ParameterSubstitution
  • Improve this Doc
  • View Source
Back to top Copyright © 2015-2017 Microsoft
Generated by DocFX