Exemplo n.º 1
0
        public OperationResult <List <Dish> > List()
        {
            try
            {
                var trOps = new TransactionOptions
                {
                    IsolationLevel = IsolationLevel.ReadCommitted,
                    Timeout        = TimeSpan.FromSeconds(30)
                };

                using var transactionScope = new TransactionScope(TransactionScopeOption.Required, trOps, TransactionScopeAsyncFlowOption.Enabled);
                var res = _dao.List();
                transactionScope.Complete();

                return(new OperationResult <List <Dish> >()
                {
                    Success = true, Result = res
                });
            }
            catch (Exception e)
            {
                return(new OperationResult <List <Dish> >()
                {
                    Success = false, Exception = e
                });
            }
        }
Exemplo n.º 2
0
 public virtual OperationResult <List <Dish> > List()
 {
     try
     {
         using var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions, TransactionScopeAsyncFlowOption.Enabled);
         var result = _dao.List();
         transactionScope.Complete();
         return(new OperationResult <List <Dish> > {
             Result = result, Success = true
         });
     }
     catch (Exception e)
     {
         return(new OperationResult <List <Dish> >()
         {
             Success = false, Exception = e
         });
     }
 }
 public OperationResult <List <Dish> > List()
 {
     try
     {
         using (var ts = new TransactionScope(TransactionScopeOption.Required, opts, TransactionScopeAsyncFlowOption.Enabled))
         {
             var result = _dao.List();
             ts.Complete();
             return(new OperationResult <List <Dish> >()
             {
                 Success = true, Result = result
             });
         }
     }
     catch (Exception e)
     {
         return(new OperationResult <List <Dish> >()
         {
             Success = false, Exception = e
         });
     }
 }
Exemplo n.º 4
0
 public OperationResult <List <Dish> > List()
 {
     return(ExecuteOperation(() => _dao.List()));
 }