public int Inset(Test2 item) { using (var db = GetConnection()) { return(DapperLambdaExt.Insert(db, item)); } }
public void InsertIfNot(int count, string prefix) { using (var db = GetConnection()) { var ecount = DapperLambdaExt.Query <Test2>(db, null).ToList().Count; if (count > ecount) { var waitInsertcount = count - ecount; for (var i = 0; i < waitInsertcount; i++) { var item = new Test2() { Name = prefix + i.ToString() }; DapperLambdaExt.Insert(db, item); } } } }