当前位置: 首页>>代码示例>>C#>>正文


C# ICommand.ToString方法代码示例

本文整理汇总了C#中ICommand.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ICommand.ToString方法的具体用法?C# ICommand.ToString怎么用?C# ICommand.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICommand的用法示例。


在下文中一共展示了ICommand.ToString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RouteToHandler

        public void RouteToHandler(ICommand command)
        {
            //optype set in logger context information about the logical operation that the system is executing
            //is used to group log messages togheter and to correlate child log to a logical operation.
            _logger.SetOpType("command", command.GetType().FullName + " Id:" + command.Id);
            
            _logger.Info("[queue] processing command " + command.ToString());

            var commandType = command.GetType();
            
            //get the executor function from the catalog, and then simply execute the command.
            var commandinvoker = _commandHandlerCatalog.GetExecutorFor(commandType);
            try
            {
                commandinvoker.Invoke(command);
                _logger.Info("[queue] command handled " + command.ToString());
            }
            catch (System.Exception ex)
            {
                //TODO log or do something better instead of retrhowing exception
                _logger.Error("[queue] Command error " + ex.Message, ex);
                throw;
            }
            finally 
            {
                _logger.RemoveOpType();
            }
            
        }
开发者ID:AGiorgetti,项目名称:Prxm.Cqrs,代码行数:29,代码来源:DefaultCommandRouter.cs

示例2: ExecuteCommand

 public ICommand ExecuteCommand(ICommand command)
 {
     Stack<ICommand> commandStack = GetCommandStack();
       command.Execute();
       SubscriptionService.SubscriptionService.NotifyAll(command.ToString());
       commandStack.Push(command);
       return command;
 }
开发者ID:iliasashaikh,项目名称:Orderprocessing,代码行数:8,代码来源:CommandService.cs

示例3: Dispatch

        public void Dispatch(ICommand cmd)
        {
            if (cmd.Timestamp == DateTime.MinValue)
            {
                throw new ArgumentException("Command must have a timestamp: " + cmd.GetType());
            }

            if (this.services.ContainsKey(cmd.GetType()))
            {
                foreach (var handler in this.services[cmd.GetType()])
                {
                    lock (onecommand)
                    {
                        Logger.DebugFormat("Dispatching Command: {0}", cmd.ToString());
                        handler.Execute(cmd);                        
                    }
                }
            }
            else
            {
                throw new InvalidOperationException(string.Format("No service to execute command {0}", cmd));
            }
        }
开发者ID:jaceenet,项目名称:TastyDomainDriven,代码行数:23,代码来源:InProcessBus.cs

示例4: SendCommand

        /// <summary>
        /// Sends a command over the network
        /// </summary>
        /// <param name="command">The command to be sent</param>
        /// <param name="process">Should the command data be processed?</param>
        public virtual void SendCommand(ICommand command, bool process = true)
        {
            lock (lockObject)
            {
                string commandString = command.ToString() + '\n';
                if (commandString.Length > 511)
                {
                    throw new CommandTooLongException();
                }
                if (socket == null)
                {
                    return;
                }
                OnSendRawData(commandString);

                byte[] data = ConnectionEncoding.GetBytes(commandString);
                SendData(data);

                if (process)
                {
                    OnReceive(commandString, true);
                }
            }
        }
开发者ID:danij,项目名称:IRCService.NET,代码行数:29,代码来源:IRCService.cs

示例5: ExecuteCommand

 private void ExecuteCommand(ICommand command)
 {
     try
     {
         command.Execute();
     }
     catch (ThreadAbortException)
     {
         _logger.DebugFormat("Swallowed ThreadAbortException");
         //Swallow. A redirect has happened
     }
     catch (Exception ex)
     {
         _logger.WarnFormat(ex, "Failed to execute {0} command", command.ToString());
     }
 }
开发者ID:Tigraine,项目名称:elms-connector,代码行数:16,代码来源:ElmsHandler.cs

示例6: DebugPrintCommand

        static void DebugPrintCommand(string prefix, ICommand command)
        {
            System.Diagnostics.Debugger.Log(0, "CmdHistory",
                String.Format("{0}:{1}\n", prefix, command.ToString()));

            CommandCollection cq = command as CommandCollection;
            if (cq != null)
            {
                for (int i = 0; i < cq.Count; ++i)
                {
                    System.Diagnostics.Debugger.Log(0, "CmdHistory",
                        String.Format("    [{0}]:{1}\n", i, cq[i].ToString()));
                }
            }
        }
开发者ID:Thecontrarian,项目名称:GALAGARAIDEN,代码行数:15,代码来源:CommandHistory.cs

示例7: SaveEventsOnEventStore

 protected override void SaveEventsOnEventStore(ICommand command, EntityId entityId, IEnumerable<IEvent> versionedEvents)
 {
     var aggregateRootId = command.AggregateRootId;
     var eventDescriptors = versionedEvents.Select(evnt => BuildEventDescriptor(command.CommandId, entityId, evnt));
     CommandDescriptorsFor(aggregateRootId).Add(new CommandDescriptor(command.CommandId, aggregateRootId, command.Created, AggregateRootType(aggregateRootId), CommandType(command), command.ToString()));
     EventDescriptorsForEntity(entityId).AddRange(eventDescriptors);
 }
开发者ID:dgmachado,项目名称:EventSourcingAndCQRSLib,代码行数:7,代码来源:InMemoryEventStore.cs

示例8: UnregisterCommand

 public override void UnregisterCommand(ICommand command)
 {
     StackFrame frame = new StackFrame(skipFrames);
     var method = frame.GetMethod();
     var type = method.DeclaringType;
     var name = method.Name;
     var c = command.ToString();
     var key = string.Format("{0}.{1} -> {2}", type.Name, name, Label);
     Registrations.remove(key);            
     base.UnregisterCommand(command);
 }
开发者ID:StackableRegiments,项目名称:metl2011,代码行数:11,代码来源:Commands.cs

示例9: RunCommand

        void RunCommand(ICommand command)
        {
            _serviceClient.CommandClient.ExecuteCommand(command);
              _commandStack.Push(command);
              ToolStripMenuItem undoCommandMenuItem = new ToolStripMenuItem(command.ToString());
              undoToolStripMenuItem.DropDownItems.Add(undoCommandMenuItem);

              //undoToolStripMenuItem.Click += (s, e) =>
              //  {
              //    UndoCommand();
              //    undoToolStripMenuItem.DropDownItems.RemoveAt(undoToolStripMenuItem.DropDownItems.Count-1);
              //  };
        }
开发者ID:iliasashaikh,项目名称:Orderprocessing,代码行数:13,代码来源:OrderProcessingDemo.cs


注:本文中的ICommand.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。