Questions
Answer the following questions to test the knowledge you have gained from this chapter:
- What Dapper method can be used to execute a stored procedure that returns no results?
- What Dapper method can be used to read a single record of data, where the record is guaranteed to exist?
- What Dapper method can be used to read a collection of records?
- What is wrong with the following statement, which calls the Dapper
Query
method?return connection.Query<BuildingGetManyResponse>( @"EXEC dbo.Building_GetMany_BySearch @Search = @Search", new { Criteria = "Fred"} );
- We have the following stored procedure:
CREATE PROC dbo.Building_GetMany AS BEGIN SET NOCOUNT ON SELECT BuildingId, Name FROM dbo.Building END
We have the following statement, which calls the Dapper
Query
method:return connection.Query<BuildingGetManyResponse>...