public void Dispose() { if (!this.isShadow) { this.list.Clear(); } UnitOfWork currentUnitOfWork = GetCurrentUnitOfWork(); if (currentUnitOfWork == this) { UnitOfWorkStack.TryPop(out currentUnitOfWork); } }
/// <summary> /// 提交事务 /// </summary> public void Complete() { UnitOfWork currentUnitOfWork = GetCurrentUnitOfWork(); if (currentUnitOfWork != this) { throw new Exception("当前提交的事务内还有未完成的其他事务,请先完成内部的事务"); } if ((this.Option == UnitOfWorkOption.RequiresNew) || ((this.Option == UnitOfWorkOption.Required) && !this.isShadow)) { this.Commit(); } UnitOfWorkStack.TryPop(out currentUnitOfWork); this.Dispose(); }