コード例 #1
0
        public static void RemoveEntity(EntityConfig entity)
        {
            FileInfo info = new FileInfo(entity.DesignerInfo.SelectDocView.DocData.FileName);

            //业务层
            string fileName = info.DirectoryName + "\\Business\\" + entity.ClassName + "Business.cs";;

            RemoveFromProject(fileName, entity.DesignerInfo);

            //数据层
            string dicPath = info.DirectoryName + "\\DataAccess";

            entity.InitDBConfig();
            DataAccessMappingConfig dalconfig = new DataAccessMappingConfig(entity);

            foreach (ComboBoxItem itype in Generate3Tier.DataAccessTypes)
            {
                string type    = itype.Value.ToString();
                string dalPath = dicPath + "\\" + type;
                fileName = dalPath + "\\" + entity.ClassName + "DataAccess.cs";
                RemoveFromProject(fileName, entity.DesignerInfo);

                dalconfig.DeleteDal(dalconfig.DataAccessNamespace + "." + type + "." + entity.ClassName + "DataAccess");
                dalconfig.DeleteBo(dalconfig.BusinessNamespace + "." + entity.ClassName + "Business");
            }
            dalconfig.SaveXML();
            string idalPath = dicPath + "\\IDataAccess";

            fileName = idalPath + "\\I" + entity.ClassName + "DataAccess.cs";
            RemoveFromProject(fileName, entity.DesignerInfo);
            idalPath = dicPath + "\\Bql";
            fileName = idalPath + "\\" + entity.ClassName + "DataAccess.cs";
            RemoveFromProject(fileName, entity.DesignerInfo);



            //删除BQLEntity
            fileName = info.DirectoryName + "\\BQLEntity\\" + entity.ClassName + ".cs";
            RemoveFromProject(fileName, entity.DesignerInfo);

            //BEM.xml
            fileName = info.DirectoryName + "\\BEM\\" + entity.ClassName + ".BEM.xml";
            RemoveFromProject(fileName, entity.DesignerInfo);

            //移除实体
            fileName = entity.FileName;
            RemoveFromProject(fileName, entity.DesignerInfo);
            fileName = entity.FileName.Replace(".cs", ".extend.cs");
            RemoveFromProject(fileName, entity.DesignerInfo);
        }
コード例 #2
0
 public Generate3Tier(DBEntityInfo entity, ClassDesignerInfo info)
     : base(entity, info)
 {
     dmt = new DataAccessMappingConfig(entity, info);
 }
コード例 #3
0
 public Generate3Tier(EntityConfig entity)
     : base(entity)
 {
     dmt = new DataAccessMappingConfig(entity);
 }