public override MyObjectBuilder_ComponentBase Serialize(bool copy = false) { var ob = new MyObjectBuilder_HierarchyComponentBase(); foreach (var child in Children) { if (child.Entity.Save) { ob.Children.Add(child.Entity.GetObjectBuilder(copy)); } } return(ob); }
public override MyObjectBuilder_ComponentBase Serialize(bool copy = false) { var ob = new MyObjectBuilder_HierarchyComponentBase(); foreach (var child in Children) { //IMPORTANT - entities that are supposed to be saved in hierarchy should be saved ONLY in hierarchy if (child.Entity.Save) { ob.Children.Add(child.Entity.GetObjectBuilder(copy)); } } // Dont serialize when empty return(ob.Children.Count > 0 ? ob : null); }