public void ExecuteAfterTransactionCompletion(bool success)
 {
     if (_session.Factory.Settings.IsDataDefinitionInTransactionSupported)
     {
         Isolater.DoIsolatedWork(_work, _session);
     }
     else
     {
         Isolater.DoNonTransactedWork(_work, _session);
     }
 }
 public Task ExecuteAfterTransactionCompletionAsync(bool success, CancellationToken cancellationToken)
 {
     if (cancellationToken.IsCancellationRequested)
     {
         return(Task.FromCanceled <object>(cancellationToken));
     }
     try
     {
         if (_session.Factory.Settings.IsDataDefinitionInTransactionSupported)
         {
             return(Isolater.DoIsolatedWorkAsync(_work, _session, cancellationToken));
         }
         else
         {
             return(Isolater.DoNonTransactedWorkAsync(_work, _session, cancellationToken));
         }
     }
     catch (System.Exception ex)
     {
         return(Task.FromException <object>(ex));
     }
 }