Forked from EliJDonahue/aras_labs_combining_items_best_practice.cs
Last active
December 1, 2017 03:27
-
-
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()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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