Esempio n. 1
0
        /// <summary>
        /// Creates a GraphNode and adds it to ObjectGraphData
        /// </summary>
        /// <param name="type">The type of the instance that this GraphNode represents</param>
        /// <returns>The GraphNode instance that was created</returns>
        public GraphNode CreateGraphNode(Type type)
        {
            ExceptionUtilities.CheckArgumentNotNull(type, "type");

            GraphNode node = new GraphNode(type, this);
            this.graphNodes.Add(node);
            return node;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a GraphNode for the instance passed in
        /// and adds it to ObjectGraphData
        /// </summary>
        /// <param name="instance">The instance</param>
        /// <returns>The GraphNode instance that was created</returns>
        public GraphNode CreateGraphNode(object instance)
        {
            ExceptionUtilities.CheckArgumentNotNull(instance, "instance");

            GraphNode node = new GraphNode(instance, this);
            this.graphNodes.Add(node);
            return node;
        }
Esempio n. 3
0
        /// <summary>
        /// Tries the get GraphNode based on the underlying instance
        /// </summary>
        /// <param name="instance">The instance.</param>
        /// <param name="graphNode">The graph node.</param>
        /// <returns>true, if the GraphNode corresponding to the instance was found, false if not</returns>
        public bool TryGetGraphNode(object instance, out GraphNode graphNode)
        {
            ExceptionUtilities.CheckArgumentNotNull(instance, "instance");
            graphNode = this.graphNodes.Where(e => object.ReferenceEquals(e.Instance, instance)).SingleOrDefault();

            return graphNode != null;
        }