public async Task <Question?> FindComplete(long id) { var con = await MysqlConnector.GetConnection(); var command = new MySqlCommand( "SELECT `id`, `title`, `message`, `asker` FROM `questions` WHERE `id` = @id LIMIT 0, 1", con ); if (command == null) { throw new Exception(""); } command.Parameters.AddWithValue("@id", id); var result = await command.ExecuteReaderAsync(); if (result == null) { throw new Exception(""); } if (!await result.ReadAsync()) { return(null); } // Yeah, this could've been an inner join, but let's keep things simple. normally you would have an ORM here too. var user = await UserRepository.Find(result.GetInt64("asker")); if (user == null) { throw new Exception("Question creator not found"); } var question = new Question( result.GetInt64("id"), result.GetString("title"), result.GetString("message"), user ); var answers = await AnswerRepository.ByQuestion(question.Id); question.Answers = answers; return(question); }