/// <summary> /// Insert list of nodes into database as bulk /// </summary> /// <param name="nodesList">List of nodes fo insert</param> public void InsertBulk(List <Node> nodesList) { var adapter = new GraphTableAdapters.NodesTableAdapter(); var newRecords = new Graph.NodesDataTable(); foreach (var node in nodesList) { newRecords.AddNodesRow(node.id, node.label, node.adjacentNodes); } adapter.Update(newRecords); }
/// <summary> /// Retrieves list of Nodes with UniDirectional relationships /// </summary> /// <returns> List of Nodes from database</returns> public List <Node> GetNodes() { var adapter = new GraphTableAdapters.NodesTableAdapter(); Graph.NodesDataTable nodesBack = adapter.GetData(); IEnumerable <Node> nodesList = nodesBack.Select(nodeBack => new Node { id = (byte)nodeBack.id, //TODO change in Node to long cause contract failure label = nodeBack.label, adjacentNodes = nodeBack.adjacentNodes }); return(nodesList.ToList()); }