/// <summary>
        /// Get all the methods invoked by this methods: both locally or externally
        /// Using MethodAnalyzer. Sometimes doesn't work!!!
        /// </summary>
        /// <param name="md"></param>
        /// <returns></returns>
        public static HashSet<string> GetInvokedMethodNameInTheMethod_Stale(MethodDefinition md)
        {
            HashSet<string> invokedMethodNames = new HashSet<string>();

            HibernateMethodAnalyzer mAnalyzer = new HibernateMethodAnalyzer(md);
            foreach (MethodDefinition invmd in mAnalyzer.InvokedLocalMethods)
            {
                if (invmd != null)
                {
                    invokedMethodNames.Add(invmd.GetFullName());
                }
            }
            foreach (MethodDefinition invmd in mAnalyzer.InvokedExternalMethods)
            {
                if (invmd != null)
                {
                    invokedMethodNames.Add(invmd.GetFullName());
                }
            }
            return invokedMethodNames;
        }
        /// <summary>
        /// Get all the varibles used in the methods, including
        /// paras, local variables, get/set field, property fields
        /// </summary>
        /// <param name="md"></param>
        /// <returns>link variable name to variable type</returns>
        public static Dictionary<string, string> GetVariableListForMethod(MethodDefinition md)
        {
            Dictionary<string, string> varList = new Dictionary<string, string>();

            HibernateMethodAnalyzer mAnalyzer = new HibernateMethodAnalyzer(md);
            foreach (VariableDeclaration vi in mAnalyzer.Paras)
            {
                if (!varList.ContainsKey(vi.Name))
                {
                    varList.Add(vi.Name, vi.VariableType.ToString());
                }
            }
            foreach (VariableInfo vi in mAnalyzer.VariablesInfo)
            {
                if (!varList.ContainsKey(vi.GetName()))
                {
                    varList.Add(vi.GetName(), vi.GetVariableType().ToString());
                }
            }
            foreach (VariableDeclaration vi in mAnalyzer.GetSelfFields)
            {
                if (!varList.ContainsKey(vi.Name))
                {
                    varList.Add(vi.Name, vi.VariableType.ToString());
                }
            }
            foreach (VariableDeclaration vi in mAnalyzer.SetSelfFields)
            {
                if (!varList.ContainsKey(vi.Name))
                {
                    varList.Add(vi.Name, vi.VariableType.ToString());
                }
            }
            foreach (VariableDeclaration vi in mAnalyzer.PropertyFields)
            {
                if (!varList.ContainsKey(vi.Name))
                {
                    varList.Add(vi.Name, vi.VariableType.ToString());
                }
            }
            return varList;
        }
        /// <summary>
        /// Check if the given method is a SQL Operating method, 
        /// that is get/set/constructor defined in a POJO class
        /// </summary>
        /// <param name="method"></param>
        /// <param name="allDBClassToTableName"></param>
        /// <param name="allDBClassPropToTableAttr"></param>
        /// <returns>Return null if not SQL Operating method.</returns>
        public static BasicMethod CheckIfGetSetMethodsInPOJOClass(MethodDefinition method, Dictionary<string, string> allDBClassToTableName, Dictionary<string, string> allDBClassPropToTableAttr)
        {
            BasicMethod basictMethod = null;

            string methodFullName = method.GetFullName();
            string curClassName = "";
            TypeDefinition declaringClass = MethodUtil.GetDeclaringClass(method);
            if (declaringClass == null)
            {
                return basictMethod;
            }
            else
            {
                curClassName = declaringClass.GetFullName();
            }

            //Console.WriteLine(curClassName);
            if (!allDBClassToTableName.ContainsKey(curClassName)) // if not from POJO class return;
            {
                return basictMethod;
            }

            HibernateMethodAnalyzer mAnalyzer = new HibernateMethodAnalyzer(method);
            if (mAnalyzer.IsSuccess != 0)
            {
                //Console.WriteLine(mAnalyzer.GetFailInfo());
                return basictMethod;
            }

            string tableName = allDBClassToTableName[curClassName];

            // (1) handle Basic POJO DB Class Constructors
            if (method.IsConstructor)
            {
                HashSet<string> attrList = new HashSet<string>();
                foreach (VariableDeclaration vd in mAnalyzer.SetSelfFields)
                {
                    string fullClassPropName = curClassName + "." + vd.Name;
                    if (allDBClassPropToTableAttr.ContainsKey(fullClassPropName))
                    {
                        string[] temps = allDBClassPropToTableAttr[fullClassPropName].Split('.');
                        attrList.Add(temps[1]);
                    }
                }
                basictMethod = new BasicMethod(Constants.BasicMethodType.Construct, tableName, attrList);
            }
            else // (2) handle Basic POJO DB Class Get/Set methods
            {
                HashSet<VariableDeclaration> getSelfFiels = mAnalyzer.GetSelfFields;
                HashSet<VariableDeclaration> setSelfFiels = mAnalyzer.SetSelfFields;
                if (getSelfFiels.Count() == 1 && setSelfFiels.Count() == 0)
                {
                    VariableDeclaration para = getSelfFiels.SingleOrDefault();
                    string fullClassPropName = curClassName + "." + para.Name;
                    if (allDBClassPropToTableAttr.ContainsKey(fullClassPropName))
                    {
                        string[] temps = allDBClassPropToTableAttr[fullClassPropName].Split('.');
                        HashSet<string> attrList = new HashSet<string>();
                        attrList.Add(temps[1]);
                        basictMethod = new BasicMethod(Constants.BasicMethodType.Get, tableName, attrList);
                    }
                }
                if (setSelfFiels.Count() == 1 && getSelfFiels.Count() == 0)
                {
                    VariableDeclaration para = setSelfFiels.SingleOrDefault();
                    string fullClassPropName = curClassName + "." + para.Name;
                    if (allDBClassPropToTableAttr.ContainsKey(fullClassPropName))
                    {
                        string[] temps = allDBClassPropToTableAttr[fullClassPropName].Split('.');
                        HashSet<string> attrList = new HashSet<string>();
                        attrList.Add(temps[1]);
                        basictMethod = new BasicMethod(Constants.BasicMethodType.Set, tableName, attrList);
                    }
                }
            }
            return basictMethod;
        }