Questions

Answer the following questions to test the knowledge we have gained in this chapter:

  1. What Dapper method can be used to execute a stored procedure that returns no results?
  2. What Dapper method can be used to read a single record of data where the record is guaranteed to exist?
  3. What Dapper method can be used to read a collection of records?
  4. What is wrong with the following statement that calls the Dapper Query method?
return connection.Query<BuildingGetManyResponse>(
@"EXEC dbo.Building_GetMany_BySearch
@Search = @Search",
new { Criteria = "Fred"}
);
  1. 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 that calls the Dapper Query method:

return connection.Query<BuildingGetManyResponse>(
"EXEC dbo.Building_GetMany"
);

We also have the following model that is referenced in the preceding statement:

public class BuildingGetManyResponse
{
public int Id{ get; set; }
public string Name { get; set; }
}

When our app is run, we find that the Id property within the BuildingGetManyResponse class instances is not populated. Can you spot the problem?

  1. Can DbUp be used to deploy new reference data within a table?
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.135.186.154