예제 #1
0
        private void EntityListBind()
        {
            List <EntityInfo> list = DLLAnalysis.GetEntityInfoList();

            foreach (EntityInfo einfo in list)
            {
                CheckBox cbox = new CheckBox();
                cbox.Text = einfo.EntityDisplayName;
                cbox.Name = einfo.EntityName;
                pnlChk.Controls.Add(cbox);
            }
        }
예제 #2
0
        private void BuildTable(string dataName, string DbfilePath)
        {
            //List<EntityInfo> list = DLLAnalysis.GetEntityInfoList();
            StringBuilder sb = null;

            foreach (Control ctrl in pnlChk.Controls)
            {
                if (!((CheckBox)ctrl).Checked)
                {
                    continue;
                }
                EntityInfo einfo = DLLAnalysis.GetEntityInfoByType(DLLAnalysis.GetEntityInstance(((CheckBox)ctrl).Name).GetType());
                sb = new StringBuilder();
                sb.Append("Begin Transaction;");
                sb.Append(ORMBuilder.DropTableIfExists(einfo));
                sb.Append("\r\n");
                sb.Append(ORMBuilder.GenerateTableByEntityInfo(einfo));
                sb.Append("\r\n");
                sb.Append("Commit Transaction;");
                ORMBuilder.AddSQLiteTable(dataName, DbfilePath, sb.ToString());
                sb.Append(string.Format("---------------------->>构造实体{0}数据表成功!", einfo.EntityName));
                sb.Append("\r\n");
                sb.Append("\r\n");
                textBox1.Text += sb.ToString();
            }
            string initData = ORMBuilder.LoadInitialData(pnlChk);

            if (string.IsNullOrEmpty(initData))
            {
                return;
            }
            textBox1.Text += "/**********************************************************************************************************************************************************************************/\r\n";
            DBSQLiteHelper.ExecuteUpdate(initData);
            textBox1.Text += "\r\n";
            textBox1.Text += initData;
            textBox1.Text += "\r\n";
            textBox1.Text += "************************>>实体数据初始化插入完成!";
        }