コード例 #1
0
        void ThreadWork()
        {
            SetBtnDisable();
            string strnamespace = this.txtNamespace.Text.Trim();
            string strfolder    = this.txtTargetFolder.Text.Trim();
            int    tblCount     = this.listTable2.Items.Count;

            SetprogressBar1Max(tblCount);
            SetprogressBar1Val(1);
            SetlblStatuText("0");

            #region 循环每个表

            for (int i = 0; i < tblCount; i++)
            {
                string tablename = this.listTable2.Items[i].ToString();
                this.ClassName = tablename;
                DataTable         dtkey   = dbobj.GetKeyName(dbname, tablename);
                List <ColumnInfo> collist = dbobj.GetColumnInfoList(dbname, tablename);
                this.BuilderEntity(this.OutPutPath, tablename);
                this.BuilderTable(this.OutPutPath, tablename);
                this.BuilderManager(this.OutPutPath, tablename);
                string fileName = this.OutPutPath + "\\" + this.Project + ".BizLogic\\IService\\" + "I" + className + "Service.cs";
                this.BuilderIServic(fileName, tablename);
                fileName = this.OutPutPath + "\\" + this.Project + ".BizLogic\\Service\\" + className + "Service.cs";
                this.BuilderService(fileName, tablename);
                SetprogressBar1Val(i + 1);
                SetlblStatuText((i + 1).ToString());
            }

            #endregion

            SetBtnEnable();
            this.Invoke(new MethodInvoker(() => { MessageBox.Show(this, "代码批量生成成功!", "完成", MessageBoxButtons.OK, MessageBoxIcon.Information); }));
        }