December 2019
Intermediate to advanced
598 pages
12h 21m
English
Let's implement the QuestionExists method now, following the same approach as the previous methods:
public bool QuestionExists(int questionId){ using (var connection = new SqlConnection(_connectionString)) { connection.Open(); return connection.QueryFirst<bool>( @"EXEC dbo.Question_Exists @QuestionId = @QuestionId", new { QuestionId = questionId } ); }}
We are using the Dapper QueryFirst method rather than QueryFirstOrDefault because the stored procedure will always return a single record.
Read now
Unlock full access