public void SingleRequireSVWithoutOuterTransTest() { Guid result = Guid.Empty; //using (var trans = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(1, 1, 1, 0))) //{ Console.Write("服务执行前的事务属性:"); //LogTransactionInfo(Transaction.Current); var sv = new TransSVAgent(); result = sv.Required(true); Console.Write("服务完成后事务提交前的事务属性:"); //LogTransactionInfo(Transaction.Current); // trans.Complete(); //} var entity = _repository.GetByID<Category>(result); Assert.IsNotNull(entity); }
public void SingleRequireSVDoNotCommitTest() { var result = TransInvoke.InvokTransFunction(() => { var sv = new TransSVAgent(); return sv.Required(true); }, false); //using (var trans = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(1, 1, 1, 0))) //{ // Console.Write("服务执行前的事务属性:"); // //LogTransactionInfo(Transaction.Current); // var sv = new TransSVAgent(); // result = sv.Required(true); // Console.Write("服务完成后事务提交前的事务属性:"); // //LogTransactionInfo(Transaction.Current); //} var entity = _repository.GetByID<Category>(result); Assert.IsNull(entity); }
public void SingleRequireSVFailedTest() { var result = TransInvoke.InvokTransFunction(() => { var sv = new TransSVAgent(); return sv.Required(false); }, true); //using (var trans = new TransactionScope(TransactionScopeOption.Required, new TimeSpan(1, 1, 1, 0))) //{ // Console.Write("服务执行前的事务属性:"); // //LogTransactionInfo(Transaction.Current); // var sv = new TransSVAgent(); // result = sv.Required(false); // Console.Write("服务完成后事务提交前的事务属性:"); // //LogTransactionInfo(Transaction.Current); //} }
public void LoadTest() { var sv = new TransSVAgent(); sv.Required(true); }