/// <summary> /// Create the requested node and items. /// </summary> /// <param name="nodeName"></param> /// <param name="itemNames"></param> public void CreateNodeAndItems(string nodeName, IEnumerable <string> itemNames) { if (_Session.ActiveTrans) { throw new InvalidOperationException("Unable to create data, as transaction is already open."); } _Session.BeginTrans(TransactionMode_e.TXN_UPDATE_E, false); { //Get/Add Node var node = _Session.GetNode(nodeName) ?? _Session.AddNode(nodeName, NodeType_e.NODE_DATA_ENTRY_E); //Create all the required items foreach (var item in itemNames.Select(itemName => node.GetItem(itemName) ?? node.AddItem(itemName))) { Console.WriteLine("Item " + item._FullyQualifiedName + " created."); } } _Session.CommitTrans(); }