Exemplo n.º 1
0
        ///// <summary>
        ///// 清空项目的编译缓存
        ///// </summary>
        //public void ClearCache(EntityInfo entityInfo, List<UIProjectItem> lstItem)
        //{
        //    foreach (UIProjectItem pitem in lstItem)
        //    {
        //        string mPath = UIConfigItem.FormatParameter(pitem.ModelPath, entityInfo);
        //        CodeGenCache.DeleteGenerationer(mPath);
        //        if (pitem.ChildItems != null && pitem.ChildItems.Count > 0)
        //        {
        //            ClearCache(entityInfo, pitem.ChildItems);
        //        }
        //    }
        //}

        /// <summary>
        /// 生成代码
        /// </summary>
        /// <param name="entityInfo">实体信息</param>
        /// <param name="classConfig">UI配置信息</param>
        /// <param name="selectPropertys">选中需要生成的属性信息</param>
        /// <param name="lstItem">UI项目项</param>
        /// <param name="parentItem">父项</param>
        /// <returns></returns>
        private void GenerateCode(EntityInfo entityInfo, UIConfigItem classConfig, Project selectedProject,
                                  List <UIModelItem> selectPropertys, UIModelItem classInfo, List <UIProjectItem> lstItem, ProjectItem parentItem)
        {
            Encoding fileEncoding = null;

            foreach (UIProjectItem pitem in lstItem)
            {
                string      mPath   = UIConfigItem.FormatParameter(pitem.ModelPath, entityInfo, selectedProject);
                string      tPath   = UIConfigItem.FormatParameter(pitem.TargetPath, entityInfo, selectedProject);
                CodeGenInfo info    = CodeGenCache.GetGenerationer(mPath, entityInfo);
                string      content = info.Invoke(entityInfo, classConfig, selectPropertys, classInfo);
                fileEncoding = pitem.Encoding;
                ProjectItem item = SaveItem(tPath, selectedProject, content, pitem.GenType, parentItem, fileEncoding);
                if (pitem.ChildItems != null && pitem.ChildItems.Count > 0)
                {
                    GenerateCode(entityInfo, classConfig, selectedProject, selectPropertys, classInfo, pitem.ChildItems, item);
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 清空项目的编译缓存
 /// </summary>
 public void ClearCache(EntityInfo entityInfo)
 {
     CodeGenCache.Clear();
 }
Exemplo n.º 3
0
        //private void gvProject_CellContentClick(object sender, DataGridViewCellEventArgs e)
        //{
        //    if (e.RowIndex < 0)
        //    {
        //        return;
        //    }
        //    string colName = gvProject.Columns[e.ColumnIndex].Name;
        //    if (colName == "colRefreash")
        //    {
        //        UIProject item = gvProject.Rows[e.RowIndex].DataBoundItem as UIProject;
        //        item.ClearCache(_curEntityInfo);
        //    }


        //}


        private void btnReFreash_Click(object sender, EventArgs e)
        {
            CodeGenCache.Clear();
        }