示例#1
0
        public GraphNode For(object currentObject, Type referenceType, string referenceName, IEnumerable<object> graphPath)
        {
            if (currentObject == null) throw new ArgumentNullException("currentObject");
            if (referenceType == null) throw new ArgumentNullException("referenceType");
            if (referenceName == null) throw new ArgumentNullException("referenceName");
            if (graphPath == null) throw new ArgumentNullException("graphPath");

            GraphNode node = new GraphNode()
                             {
                                 ReferenceType = referenceType,
                                 ObjectType = currentObject.GetType(),
                                 ReferenceName = referenceName,
                             };

            if ((!graphPath.Contains(currentObject)) && (!DoNotFollowType(currentObject.GetType())))
            {
                IList<GraphNode> subGraph = new List<GraphNode>();
                bool handled = this._getSubGraph.For(currentObject, graphPath.Concat(new List<object>() { currentObject }),
                                                                   out subGraph);

                node.SubGraph = subGraph;
            }

            return node;
        }
示例#2
0
        public string For(GraphNode graphNode, int depth)
        {
            if (graphNode == null) throw new ArgumentNullException("graphNode");

            string depthString = this._getDepthString.For(depth);
            string memberTypesString = this._getMemberTypesString.For(graphNode);

            string nodeString = string.Format("{0}{1}", depthString, memberTypesString);

            return nodeString;
        }
示例#3
0
        private string Draw(GraphNode graphNode, int depth)
        {
            string graph = this._getNodeString.For(graphNode, depth) + Environment.NewLine;

            depth++;

            foreach (GraphNode subGraphNode in graphNode.SubGraph)
            {
                graph += this.Draw(subGraphNode, depth);
            }

            return graph;
        }
示例#4
0
        public string For(GraphNode graphNode)
        {
            if (graphNode == null) throw new ArgumentNullException("graphNode");

            string objectTypeName;
            this._getTypeNameString.For(graphNode.ObjectType, out objectTypeName);
            string referenceTypeName;
            this._getTypeNameString.For(graphNode.ReferenceType, out referenceTypeName);

            string memberTypesString = string.Format("{0} : {1}", objectTypeName, referenceTypeName);

            return memberTypesString;
        }
示例#5
0
 public string Draw(GraphNode graphNode)
 {
     return this.Draw(graphNode, 0);
 }