private void Load(AbstractCommand command)
 {
     var currentObjectState = GetByIdInternal(command.TargetObjectId);
     var context = new CommandExecutionContext(command.TargetObjectId, currentObjectState);
     commandExecutor.Execute(command, context);
     materializedObjectStates[command.TargetObjectId] = context.Instance;
 }
        private void Load(AbstractCommand command)
        {
            var currentObjectState = GetByIdInternal(command.TargetObjectId);
            var context            = new CommandExecutionContext(command.TargetObjectId, currentObjectState);

            commandExecutor.Execute(command, context);
            materializedObjectStates[command.TargetObjectId] = context.Instance;
        }
 public void Update(AbstractCommand command)
 {
     ObjectState alreadyLoadedState;
     if (loadedStates.TryGetValue(command.TargetObjectId, out alreadyLoadedState))
     {
         var context = new CommandExecutionContext(command.TargetObjectId, alreadyLoadedState);
         commandExecutor.Execute(command, context);
     }
 }
Esempio n. 4
0
        public void Update(AbstractCommand command)
        {
            ObjectState alreadyLoadedState;

            if (loadedStates.TryGetValue(command.TargetObjectId, out alreadyLoadedState))
            {
                var context = new CommandExecutionContext(command.TargetObjectId, alreadyLoadedState);
                commandExecutor.Execute(command, context);
            }
        }
 public void Execute(AbstractCommand command, ICommandExecutionContext context)
 {
     var commandType = command.GetType();
     dynamic handler;
     if (!handlers.TryGetValue(commandType, out handler))
     {
         throw new InvalidOperationException(string.Format("No handler for {0} registered.", commandType.AssemblyQualifiedName));
     }
     dynamic dynamicCommand = command;
     handler.Handle(dynamicCommand, context);
 }
 public void Add(AbstractCommand command)
 {
     List<AbstractCommand> existingList;
     if (commands.TryGetValue(command.TargetObjectId, out existingList))
     {
         existingList.Add(command);
     }
     else
     {
         var newList = new List<AbstractCommand> {command};
         commands[command.TargetObjectId] = newList;
     }
 }
Esempio n. 7
0
        public void Execute(AbstractCommand command, ICommandExecutionContext context)
        {
            var     commandType = command.GetType();
            dynamic handler;

            if (!handlers.TryGetValue(commandType, out handler))
            {
                throw new InvalidOperationException(string.Format("No handler for {0} registered.", commandType.AssemblyQualifiedName));
            }
            dynamic dynamicCommand = command;

            handler.Handle(dynamicCommand, context);
        }
        public void Add(AbstractCommand command)
        {
            List <AbstractCommand> existingList;

            if (commands.TryGetValue(command.TargetObjectId, out existingList))
            {
                existingList.Add(command);
            }
            else
            {
                var newList = new List <AbstractCommand> {
                    command
                };
                commands[command.TargetObjectId] = newList;
            }
        }
 public UncommittedChangeSet Add(AbstractCommand command)
 {
     commands.Add(command);
     return this;
 }
 public void Add(AbstractCommand command)
 {
     commands.Add(command);
 }
Esempio n. 11
0
 public UncommittedChangeSet Add(AbstractCommand command)
 {
     commands.Add(command);
     return(this);
 }
 public void Add(AbstractCommand command)
 {
     commands.Add(command);
 }