private void CrossAssemblyWalk(MethodGraph methodGraph, MethodNode rootMethod, MethodObject currentMethod, int depth, ExploreTreeNode callTreeNode)
        {
            if (IsRecursiveLoop(callTreeNode))
            {
                return;
            }

            if (!currentMethod.HasImplementation())
            {
                // Perhaps log it somewhere in debug mode
                //File.AppendAllText("No_Implementation.txt", currentMethod.GetMethodDefinition().FullName);
                return;
            }

            var isCrossAssemblyCall = IsCrossAssemblyCall(rootMethod, currentMethod, depth);

            if (isCrossAssemblyCall)
            {
                // if it is a simple property access then we don't care. Only add it if the access is interesting
                if (IsNoteworthyMethodCall(currentMethod))
                {
                    var publicMethod = GetMethodNode(methodGraph.GraphType, methodGraph.ApplicationName, currentMethod);
                    rootMethod.CrossAssemblyCalls.Add(publicMethod);
                }
            }
            else
            {
                // continue down the call tree unless the called method is of another assembly
                // the call tree originating at that method will be generated when that assembly is analyzed
                ContinueDownCrossAssemblyTree(methodGraph, rootMethod, currentMethod, depth, callTreeNode);
            }
        }
        private bool UsesEntityFramework(MethodObject currentMethod)
        {
            bool usesEfField  = false;
            bool usesEfMethod = false;
            bool classInheritsFromObjectContext = false;

            if (currentMethod.HasImplementation())
            {
                usesEfField = currentMethod.FieldsRead.Any(
                    t => t.DeclaringType.Namespace.Equals("System.Data.EntityClient") ||
                    t.DeclaringType.Namespace.Equals("System.Data.Objects"));

                if (!usesEfField)
                {
                    var declaringTypes = currentMethod.MethodsCalled
                                         .Select(t => t.MethodCalled.DeclaringType)
                                         .GroupBy(x => x.FullName)
                                         .Select(x => x.First())
                                         .ToList();

                    foreach (var declaringType in declaringTypes)
                    {
                        if (declaringType.Namespace.Equals("System.Data.EntityClient") ||
                            declaringType.Namespace.Equals("System.Data.Objects") ||
                            declaringType.Namespace.Equals("System.Data.Entity"))
                        {
                            usesEfMethod = true;
                            break;
                        }

                        TypeDefinition typeDef = null;
                        if (ResolveService.TryResolve(declaringType, out typeDef))
                        {
                            if (typeDef.BaseType != null && (typeDef.BaseType.Namespace.Equals("System.Data.EntityClient") ||
                                                             typeDef.BaseType.Namespace.Equals("System.Data.Objects") ||
                                                             typeDef.BaseType.Namespace.Equals("System.Data.Entity")))
                            {
                                usesEfMethod = true;
                                break;
                            }
                        }
                    }
                }
            }

            return(usesEfField || usesEfMethod || classInheritsFromObjectContext);
        }
        private MethodNode GetMethodNode(GraphType graphType, string appDomain, MethodObject method)
        {
            var methodDef = method.GetMethodDefinition();

            var methodNode = new MethodNode(graphType, appDomain);

            methodNode.MethodName = SignatureKeyService.GetMethodSignature(methodDef);
            methodNode.IsPublic   = methodDef.IsPublic && methodDef.DeclaringType.IsPublic;

            if (method.HasImplementation())
            {
                methodNode.ConcreteType = new TypeInfo();
                methodNode.ConcreteType.AssemblyName    = method.ConcreteMethod.DeclaringType.Module.Assembly.Name.Name;
                methodNode.ConcreteType.AssemblyVersion = GetAssemblyVersion(method.ConcreteMethod);
                methodNode.ConcreteType.TypeName        = method.ConcreteMethod.DeclaringType.FullName;
            }
            else
            {
            }

            if (method.HasInterface())
            {
                methodNode.InterfaceType = new TypeInfo();
                methodNode.InterfaceType.AssemblyName    = method.InterfaceMethod.DeclaringType.Module.Assembly.Name.Name;
                methodNode.InterfaceType.AssemblyVersion = GetAssemblyVersion(method.InterfaceMethod);
                methodNode.InterfaceType.TypeName        = method.InterfaceMethod.DeclaringType.FullName;
            }

            if (method.HasAbstract())
            {
                methodNode.AbstractType = new TypeInfo();
                methodNode.AbstractType.AssemblyName    = method.AbstractMethod.DeclaringType.Module.Assembly.Name.Name;
                methodNode.AbstractType.AssemblyVersion = GetAssemblyVersion(method.AbstractMethod);
                methodNode.AbstractType.TypeName        = method.AbstractMethod.DeclaringType.FullName;
            }

            if (method.OverridesBaseClass())
            {
                methodNode.BaseClassType = new TypeInfo();
                methodNode.BaseClassType.AssemblyName    = method.VirtualMethod.DeclaringType.Module.Assembly.Name.Name;
                methodNode.BaseClassType.AssemblyVersion = GetAssemblyVersion(method.VirtualMethod);
                methodNode.BaseClassType.TypeName        = method.VirtualMethod.DeclaringType.FullName;
            }

            return(methodNode);
        }