/// <summary> /// Executes this query against an ObjectSpace data store and returns an array filled with the results. /// </summary> /// <param name="os">ObjectSpace instance to use.</param> /// <param name="parameters">Parameter values to use when executing the query.</param> /// <returns>An array filled with objects retrieved from the data store.</returns> public List <T> GetList(ObjectSpace os, params object[] parameters) { CompiledQuery <T> cq = this.Compile(os); List <T> list = new List <T>(32); using (ObjectReader reader = os.GetObjectReader(cq, parameters)) { while (reader.Read()) { list.Add((T)reader.Current()); } } return(list); }
private static Node getAllNodes(ObjectSpace ObjectManager, int currentNodeID, Node parent) { try { Node n = (Node)ObjectManager.GetObject(typeof(Node), currentNodeID); n.parent = parent; ObjectQuery oq = new ObjectQuery(typeof(Node), "parentID=" + currentNodeID, "rank ASC"); //ObjectReader or = ObjectManager.GetObjectReader(typeof(Node),"parentID=" + currentNodeID); ObjectReader or = ObjectManager.GetObjectReader(oq); NodeCollection nc = new NodeCollection(); foreach (Node childNode in or) { nc.Add(getAllNodes(ObjectManager, childNode.Id, n)); } n.children = nc; return(n); } catch (Exception e) { throw new Exception("problem! currentNodeID:" + currentNodeID, e); } }