sapiens/SqlFu — pull request #18 by ventaur (2013-08-31 22:55:08+00:00)
Title: Added new Fetch methods for multiple resultsets and...

...increased visibility of CreateAndSetupCommand so users can create other extension methods to suit their needs.

These methods are described in the discussion for issue: https://github.com/sapiens/SqlFu/issues/6.

If this isn't suitable, I encourage at least increasing CreateAndSetupCommand's visibility to public for the sake of doing something like this in users' own code. Also, tests are an issue with the SQLite database used in the existing tests. However, I've also been using this code in production for over a month now with great results. Here's an example:

```csharp
public IList GetQuizzesForIds(IEnumerable quizIds)
{
var args = new { QuizIds = quizIds };
string test = "select * from Quiz where Id in (@QuizIds); " +
"select * from Question where QuizId in (@QuizIds); " +
"select * from Answer A inner join Question Q on A.QuestionId = Q.Id where Q.QuizId in (@QuizIds);";

var result = Fetch(sql, args);
var allQuizzes = result.Item1;
var allQuestions = result.Item2;
var allAnswers = result.Item3;

foreach (QuizInfo quiz in allQuizzes) {
Guid quizId = quiz.Id;
var questions = allQuestions.Where(q => q.QuizId == quizId).ToList();
quiz.Questions = questions;

foreach (QuizQuestionInfo question in questions) {
Guid questionId = question.Id;
var answers = allAnswers.Where(a => a.QuestionId == questionId).ToList();
question.Answers = answers;
}
}

return allQuizzes;
}
```