コード例 #1
0
        public int CreateWithIsolationLevel(EmployeeClassification classification, bool shouldRollBack, IsolationLevel isolationLevel)
        {
            using (var db = new OrmCookbook())
                using (var trans = db.BeginTransaction(isolationLevel))
                {
                    var result = db.InsertWithInt32Identity(classification);

                    if (shouldRollBack)
                    {
                        trans.Rollback();
                    }
                    else
                    {
                        trans.Commit();
                    }

                    return(result);
                }
        }