Exemplo n.º 1
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 += "************************>>实体数据初始化插入完成!";
        }
Exemplo n.º 2
0
        public int Execute()
        {
            string sql = string.Format(sqlPattern, EInfo.EntityName, sbSetValue.ToString(), this.whereColumn, this.whereValue);

            return(DBSQLiteHelper.ExecuteUpdate(sql));
        }