Пример #1
0
        /// <summary>
        /// 运行编译函数并返回结果
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public string Invoke(EntityInfo entityInfo, UIConfigItem classConfig,
                             List <UIModelItem> selectPropertys, UIModelItem classInfo)
        {
            Buffalo.GeneratorInfo.EntityInfo entity = entityInfo.ToGeneratorEntity(classInfo);
            List <Property> lst = new List <Property>(selectPropertys.Count);

            foreach (UIModelItem item in selectPropertys)
            {
                lst.Add(item.ToGeneratItem());
            }
            try
            {
                string ret = _methodInfo.Invoke(_codeClass, new object[] { entity, lst }) as string;
                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        ///// <summary>
        ///// 过滤连接dll信息
        ///// </summary>
        ///// <param name="items"></param>
        ///// <returns></returns>
        //private string[] LinkFilter(string items)
        //{

        //}

        /// <summary>
        /// 获取代码
        /// </summary>
        /// <param name="queitem"></param>
        /// <param name="modelPath">模块路径</param>
        /// <returns></returns>
        public List <string> GetCode(Queue <ExpressionItem> queitem, EntityInfo entityInfo)
        {
            List <string> lst = new List <string>();

            while (queitem.Count > 0)
            {
                ExpressionItem item = queitem.Dequeue();
                switch (item.Type)
                {
                case ExpressionType.String:

                    lst.AddRange(item.Content.ToString().Split('\n'));
                    for (int i = 0; i < lst.Count; i++)
                    {
                        lst[i] = UIConfigItem.FormatParameter(lst[i], entityInfo, entityInfo.DesignerInfo.CurrentProject);
                    }
                    break;

                default:
                    break;
                }
            }
            return(lst);
        }