Creating a Repository Method to Get a Single Question
Learn to create a repository method that retrieves a single question and its corresponding answers.
Let’s implement the GetQuestion method now:
Start by opening the connection and executing the
Question_GetSinglestored procedure:
This method is a little different from the previous methods because we are using the QueryFirstOrDefault Dapper method to return a single record (or null if the record isn’t found) rather than a collection of records.