Esempio n. 1
0
        public static DotGraph AsDotGraph(this IServiceReference serviceReference)
        {
            DotGraph graph = new();

            Process(serviceReference);
            return(graph);

            void Process(IServiceReference serviceReference)
            {
                DotGraphNode from = serviceReference.AsDotGraphNode();

                graph.Nodes.Add(from);

                foreach (IServiceReference dep in serviceReference.Dependencies)
                {
                    DotGraphNode to = dep.AsDotGraphNode();

                    DotGraphEdge edge = new(from, to);

                    //
                    // Korkoros referencia eseten ne legyen S.O.E.
                    //

                    if (!graph.Edges.Add(edge))
                    {
                        continue;
                    }

                    graph.Nodes.Add(to);

                    Process(dep);
                }
            }
        }