public static ISqlMapper CreateMapper(EntityStatusEnum status, ISQLConvert converter) { ISqlMapper mapper = null; switch (status) { case EntityStatusEnum.Insert: mapper = new InsertMapper(converter); break; case EntityStatusEnum.Delete: mapper = new DeleteByIDMapper(converter); break; case EntityStatusEnum.Update: mapper = new UpdateByIDMapper(converter); break; case EntityStatusEnum.InsertOrUpdate: mapper = new InsertOrUpdateMapper(converter); break; } return(mapper); }
public void InsertDictLink(Word keyWordd, Word valueWordd) { var insertMappe = new InsertMapper(); insertMappe.Table = "dictword"; insertMappe.ColumnValueDict.Add("word1_id", keyWordd.Id.ToString()); insertMappe.ColumnValueDict.Add("word2_id", valueWordd.Id.ToString()); DBSQL.InserWord(insertMappe); keyWord = string.Empty; valueWord = string.Empty; }
public void InsertKeyWord(string Gword, string lang1, string lang2) { var insertMapper = new InsertMapper(); insertMapper.Table = "word"; insertMapper.ColumnValueDict.Add("word", Gword); insertMapper.ColumnValueDict.Add("national_code", lang1); DBSQL.InserWord(insertMapper); myWord = DBSQL.getID(Gword); CheckOtherLang(lang2); }
public void InsertValueWord(List <string> eList, string lang2) { foreach (var item in eList) { var insertMapper = new InsertMapper(); insertMapper.Table = "word"; insertMapper.ColumnValueDict.Add("word", item); insertMapper.ColumnValueDict.Add("national_code", lang2); DBSQL.InserWord(insertMapper); Word Otherword = DBSQL.getID(item); InsertDictLink(myWord, Otherword); } }
private void btnInsert_Click(object sender, EventArgs e) { IDBHelper helper = DBFactory.CreateDBHelper("Database = SyncDemo; uid=admin; pwd=frank;Server=localhost", DBType.MSSQL2005P); //helper.AutoCloseConnection = false; SnowFlakGenerator g = new SnowFlakGenerator(Thread.CurrentThread.ManagedThreadId); ISqlMapper mapper = new InsertMapper(new DB2Convert()); Stopwatch watch = new Stopwatch(); watch.Start(); for (int i = 0; i < 10000; i++) { Dictionary <string, object> t = new Dictionary <string, object>(); t["ID"] = g.Generate(); t["Name"] = "hello world"; t["Type"] = 3; var model = mapper.ObjectToSql(Chainway.Library.SimpleMapper.Common.GetTableName("201707", "dbo", t.GetType(), null, t), t, null); helper.ExecNoneQueryWithSQL(model.SQL, model.Parameters.ToArray()); } watch.Stop(); helper.CloseConnection(); MessageBox.Show("time:" + watch.ElapsedMilliseconds.ToString()); }