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); } }
public ICommandExecutionContext GetFor(ObjectId objectId) { CommandExecutionContext existingContext; if (contextMap.TryGetValue(objectId, out existingContext)) { return existingContext; } var newContext = new CommandExecutionContext(objectId, null); contextMap[objectId] = newContext; return newContext; }