示例#1
0
        private static void VisualizeIndentedObjectSubGraph(
            this InstanceProducer dependency,
            int indentingDepth,
            bool last,
            HashSet <InstanceProducer> set,
            ObjectGraphStringBuilder objectGraphBuilder)
        {
            bool isCyclicGraph = set.Contains(dependency);

            if (isCyclicGraph)
            {
                objectGraphBuilder.AppendCyclicInstanceProducer(dependency, last);
                return;
            }

            set.Add(dependency);

            try
            {
                dependency.VisualizeIndentedObjectGraph(indentingDepth, last, set, objectGraphBuilder);
            }
            finally
            {
                set.Remove(dependency);
            }
        }
        internal static string VisualizeIndentedObjectGraph(this InstanceProducer producer)
        {
            if (!producer.IsExpressionCreated)
            {
                return(ExpressionNotCreatedYetMessage);
            }

            var set = new HashSet <InstanceProducer>(InstanceProducer.EqualityComparer);

            return(producer.VisualizeIndentedObjectGraph(indentingDepth: 0, set: set));
        }
        internal static string VisualizeIndentedObjectGraph(this InstanceProducer producer, VisualizationOptions options)
        {
            if (!producer.IsExpressionCreated)
            {
                return(ExpressionNotCreatedYetMessage);
            }

            var set = new HashSet <InstanceProducer>(InstanceProducer.EqualityComparer);
            var objectGraphBuilder = new ObjectGraphBuilder(options.IncludeLifestyleInformation);

            producer.VisualizeIndentedObjectGraph(indentingDepth: 0, last: true, set: set, objectGraphBuilder: objectGraphBuilder);

            return(objectGraphBuilder.ToString());
        }
        private static string VisualizeIndentedObjectSubGraph(this InstanceProducer dependency,
                                                              int indentingDepth, HashSet <InstanceProducer> set)
        {
            bool isCyclicGraph = set.Contains(dependency);

            if (isCyclicGraph)
            {
                return(dependency.VisualizeCyclicProducerWithoutDependencies(indentingDepth));
            }

            set.Add(dependency);

            try
            {
                return(dependency.VisualizeIndentedObjectGraph(indentingDepth, set));
            }
            finally
            {
                set.Remove(dependency);
            }
        }