示例#1
0
 public void Execute(OperationHandlers operationHandlers) {
   var info = new OperationInfo {
     OperationId = _operationIdFactory.GetNextId()
   };
   operationHandlers.OnBeforeExecute(info);
   try {
     operationHandlers.Execute(info);
   }
   catch (Exception e) {
     Logger.LogError(e, "Error executing operation {0}", _operationIdFactory.GetNextId());
     operationHandlers.OnError(info, e);
   }
 }
        public void Execute(OperationInfo <T> operationInfo)
        {
            var operationId        = _operationIdFactory.GetNextId();
            var operationEventArgs = new OperationEventArgs {
                OperationId = operationId
            };

            operationInfo.OnBeforeExecute(operationEventArgs);
            try {
                var result = operationInfo.Execute(operationEventArgs);
                result.OperationId = operationId;
                operationInfo.OnAfterExecute(result);
            }
            catch (Exception e) {
                Logger.LogException(e, "Error executing operation {0}", operationId);
                operationInfo.OnAfterExecute(new T {
                    OperationId = operationId,
                    Error       = e
                });
            }
        }
 protected virtual void OnSnapshotComputing(OperationInfo e)
 {
     EventHandler<OperationInfo> handler = SnapshotComputing;
       if (handler != null) handler(this, e);
 }
 private void SearchEngineOnFilesLoading(object sender, OperationInfo args)
 {
     _typedEventSender.SendEventAsync(new SearchEngineFilesLoading {
     OperationId = args.OperationId
       });
 }
 private void FileSystemProcessorOnSnapshotComputing(object sender, OperationInfo e)
 {
     _typedEventSender.SendEventAsync(new FileSystemTreeComputing {
     OperationId = e.OperationId
       });
 }