框架内事务的近期发现,以后再研究

          var db = new PetaPoco.Database("SqlServer");
            var isSuc = true;
             using (var tx = db.GetTransaction())
             {
                 for (int i = 1; i < 100; i++)
                 {
                     ta_Parent a = new ta_Parent();
                     a.StudentId = i;
                     if (i ==5)
                     {
                         throw new Exception("dd");
                     }
                     a.Insert();
                 }
                 tx.Complete();
            }

这样写是不对的,因为插入操作仍然正常进行。

原文地址:https://www.cnblogs.com/axu92312/p/7008538.html