示例#1
0
 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);
 }
示例#2
0
 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);
 }
示例#3
0
        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);
            //}
        }
示例#4
0
 public void LoadTest()
 {
     var sv = new TransSVAgent();
     sv.Required(true);
 }