Example #1
0
 protected override void LoadChildren()
 {
     if (_edgeType != null)
     {
         m_session.LoadFields(_edgeType);
         foreach (var edge in _edgeType.GetEdges())
         {
             base.Children.Add(new EdgeViewModel(edge, this, m_session));
         }
         foreach (var et in _edgeType.GetPropertyTypes())
         {
             base.Children.Add(new PropertyTypeViewModel(et, this, m_session));
         }
     }
 }
Example #2
0
 public void DeleteUserVertices()
 {
     using (SessionNoServer session = new SessionNoServer(systemDir, 5000, false, true))
     {
         session.BeginUpdate();
         Graph      g                    = Graph.Open(session); // it takes a while to open graph fresh from databases
         VertexType userType             = g.FindVertexType("User");
         VertexType locationType         = g.FindVertexType("Location");
         EdgeType   friendEdgeType       = g.FindEdgeType("Friend");
         EdgeType   userLocationEdgeType = g.FindEdgeType("UserLocation");
         for (int i = 1; i < numberOfUserVertices; i++)
         {
             userType.RemoveVertex(new Vertex(g, userType, i));
         }
         Assert.IsTrue(friendEdgeType.GetEdges().Count() == 0);
         session.Commit();
         Validate();
     }
 }
Example #3
0
 void Validate()
 {
     using (SessionNoServer session = new SessionNoServer(systemDir, 5000, false, true))
     {
         session.BeginRead();
         Graph      g                    = Graph.Open(session); // it takes a while to open graph fresh from databases
         VertexType userType             = g.FindVertexType("User");
         VertexType locationType         = g.FindVertexType("Location");
         EdgeType   friendEdgeType       = g.FindEdgeType("Friend");
         EdgeType   userLocationEdgeType = g.FindEdgeType("UserLocation");
         foreach (Edge e in friendEdgeType.GetEdges())
         {
             if (e.Head == e.Tail)
             {
                 Console.WriteLine(e.Head + " is friend of itself");
             }
         }
         session.Commit();
     }
 }