コード例 #1
0
    public static ServerResponse InitiateStory(string characterName, string playerId)
    {
        Command        command   = new InitiateStory(characterName, playerId);
        Aggregate      character = AggregateRepository.GetOrCreate(typeof(CharacterAggregate), characterName);
        bool           success   = CommandHandler.HandleCommand(character, characterName, command);
        ServerResponse response  = new ServerResponse(characterName, ModelNameGetter.GetModelName(character.GetType()), !success);

        return(response);
    }
コード例 #2
0
    private Event[] InitiateStory(InitiateStory command)
    {
        if (this.id == Aggregate.NullId)
        {
            throw new ValidationException("id", "Character not found");
        }


        return(new Event[] {
            new StoryInitiated(command.characterName, command.playerId, this.rootNode)
        });
    }