public void TestSaveChange_Transations_Exception() { try { using (SqlHelperDelay sqlHelperDelay = new SqlHelperDelay()) { var company1 = sqlHelperDelay.Find <CompanyModel>(1); var company2 = sqlHelperDelay.Find <CompanyModel>(2); //×Ö·û´®³¬¹ýÊý¾Ý¿â×ֶγ¤¶È£¬Å׳öÒì³£ company2.CompanyName += " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);" + " var company2 = sqlHelperDelay.Find<CompanyModel>(2);"; sqlHelperDelay.Insert(company1); sqlHelperDelay.Insert(company2); sqlHelperDelay.SaveChange(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void TestSaveChange_Transations_Ok() { try { using (SqlHelperDelay sqlHelperDelay = new SqlHelperDelay()) { var company1 = sqlHelperDelay.Find <CompanyModel>(1); company1.CreateTime = DateTime.Now; var company2 = sqlHelperDelay.Find <CompanyModel>(2); company2.CompanyName += "Transations_Ok"; company2.CreateTime = DateTime.Now; sqlHelperDelay.Insert(company1); sqlHelperDelay.Insert(company2); sqlHelperDelay.SaveChange(); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }