public async Task <OperationResult <List <StaffTitle> > > ListAsync() { try { var transactionOptions = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted, Timeout = TimeSpan.FromSeconds(30) }; using (var ts = new TransactionScope(TransactionScopeOption.Required, transactionOptions, TransactionScopeAsyncFlowOption.Enabled)) { var result = await _dao.ListAsync(); ts.Complete(); return(new OperationResult <List <StaffTitle> >() { Success = true, Result = result }); } } catch (Exception e) { return(new OperationResult <List <StaffTitle> >() { Success = false, Exception = e }); } }
public async virtual Task <OperationResult <List <StaffTitle> > > ListAsync() { try { using var transactionScope = new TransactionScope(TransactionScopeOption.Required, transactionOptions, TransactionScopeAsyncFlowOption.Enabled); var result = await _dao.ListAsync(); transactionScope.Complete(); return(new OperationResult <List <StaffTitle> > { Result = result, Success = true }); } catch (Exception e) { return(new OperationResult <List <StaffTitle> >() { Success = false, Exception = e }); } }
public async Task <OperationResult <List <StaffTitle> > > ListAsync() { try { await _dao.ListAsync(); return(new OperationResult <List <StaffTitle> >() { Success = true }); } catch (Exception e) { return(new OperationResult <List <StaffTitle> >() { Success = false, Exception = e }); } }
public async Task <OperationResult <List <StaffTitle> > > ListAsync() { try { using (var ts = new TransactionScope(TransactionScopeOption.Required, opts, TransactionScopeAsyncFlowOption.Enabled)) { var res = await _dao.ListAsync(); ts.Complete(); return(new OperationResult <List <StaffTitle> >() { Success = true, Result = res }); } } catch (Exception e) { return(new OperationResult <List <StaffTitle> >() { Success = false, Exception = e }); } }