Example #1
0
        void TestReadWriteClient(IThingGraph thingGraph)
        {
            var GetByIdCount = ClientService.GetByIdCount;


            var thing1 = Factory.CreateItem("hello service");

            thingGraph.Add(thing1);

            var thing2 = Factory.CreateItem("a child");

            thingGraph.Add(thing2);

            thingGraph.Add(Factory.CreateEdge(thing1, thing2, Factory.CreateItem("marker")));

            var graph = ModelHelper.GetSourceGraph <ProgrammingLanguageFactory>().Two;

            foreach (var thing in graph)
            {
                thingGraph.Add(thing);
            }
            foreach (var thing in graph.Edges())
            {
                thingGraph.Add(thing);
            }
            thingGraph.Clear();

            Debug.WriteLine("**** all items of Service ****");
            try {
                int thingCount = 0;
                foreach (IThing clThing in thingGraph)
                {
                    ReportThing(clThing);
                    thingCount++;
                }
                Debug.WriteLine("** GetByIdCount = " + (ClientService.GetByIdCount - GetByIdCount));
                foreach (IThing clThing in thingGraph)
                {
                    foreach (ILink link in thingGraph.Edges(clThing))
                    {
                        ReportThing(link);
                    }
                }
                Debug.WriteLine("** GetByIdCount = " + (ClientService.GetByIdCount - GetByIdCount));
            } catch (Exception e) {
                Debug.WriteLine(e.Message);
            }
        }