/// <summary> 使用分布式事务 </summary> /// <param name="action"></param> /// <param name="level"></param> /// <param name="timeout"></param> public static void Use(Action action, IsolationLevel level = IsolationLevel.ReadUncommitted, TimeSpan? timeout = null) { using (var trans = new DTransaction(level, timeout)) { action(); trans.SaveChanges(); } }
/// <summary> 使用分布式事务 </summary> /// <param name="action"></param> /// <param name="level"></param> /// <param name="timeout"></param> public static void Use(Action action, IsolationLevel level = IsolationLevel.ReadUncommitted, TimeSpan?timeout = null) { using (var trans = new DTransaction(level, timeout)) { action(); trans.SaveChanges(); } }