public void FixProjectSorceInsert()
{ TransactionOptions transactionOption = new TransactionOptions(); //设置事务隔离级别 transactionOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; // 设置事务超时时间为120秒 transactionOption.Timeout = new TimeSpan(0, 0, 120);using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, transactionOption))
{ try { Insert();Update();
Delete();
// 没有错误,提交事务
scope.Complete(); } catch (Exception ex) { throw new Exception("发送信息异常,原因:" + ex.Message); } finally { //释放资源 scope.Dispose(); }}
}