Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save erdomke/72b4d6aee9586fa719dc350c473cc5fd to your computer and use it in GitHub Desktop.
Save erdomke/72b4d6aee9586fa719dc350c473cc5fd to your computer and use it in GitHub Desktop.
Demonstrates the Aras Best Practice of building a single AML statement instead of combining items with appendItem()
string myAml;
using (var writer = new System.IO.StringWriter())
using (var xml = System.Xml.XmlWriter.Create(writer, new System.Xml.XmlWriterSettings()
{
OmitXmlDeclaration = true
}))
{
xml.WriteStartElement("AML");
for (var i = 0; i < 10; i++)
{
xml.WriteStartElement("Item");
xml.WriteAttributeString("type", "CAD");
xml.WriteAttributeString("action", "add");
xml.WriteElementString("item_number", "Test " + i);
xml.WriteEndElement();
}
xml.WriteEndElement();
xml.Flush();
myAml = writer.ToString();
}
Item res = inn.applyAML(myAml);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment