/// <summary> /// Method adds new embedded child object(it's ID) into existing map of all /// embedded children of this CIMObject. /// <para>Child object must have not empty value for it's ID property, or it won't be added to the map.</para> /// </summary> /// <param name="cimObject">new embedded child object (CIMObject)</param> /// <returns>true if adding embedded child is successful, otherwise false</returns> public bool AddEmbeddedChild(string embeddedCategory, CIMObject cimObject) { bool success = false; if ((!string.IsNullOrEmpty(embeddedCategory)) && (cimObject != null) && (!string.IsNullOrEmpty(cimObject.ID))) { if (embeddedChildren == null) { embeddedChildren = new SortedDictionary <string, List <string> >(); } if (embeddedChildren.ContainsKey(embeddedCategory)) { embeddedChildren[embeddedCategory].Add(cimObject.ID); } else { List <string> temp = new List <string>(); temp.Add(cimObject.ID); embeddedChildren.Add(embeddedCategory, temp); } success = true; } return(success); }
/// <summary> /// Method adds new child object(it's ID) into existing map of all children of this CIMObject. /// <para>Child object must have not empty values for it's properties CIMType and ID, or it won't be added to the map.</para> /// <para>In the children map, child is added in the following way: </para> /// <para>value of CIMType property defines a key in the main map, and the value of ID property is being added in the List{string} which correspondes to that key.</para> /// </summary> /// <param name="cimObject">new child object (CIMObject) which will be addeed into children map of this CIM object</param> /// <returns>true if adding child is successful, otherwise false</returns> public bool AddChild(CIMObject cimObject) { bool success = false; if ((!string.IsNullOrEmpty(cimObject.CIMType)) && (!string.IsNullOrEmpty(cimObject.ID))) { if (children.ContainsKey(cimObject.CIMType)) { children[cimObject.CIMType].Add(cimObject.id); } else { List <string> temp = new List <string>(); temp.Add(cimObject.ID); children.Add(cimObject.CIMType, temp); } success = true; } return(success); }