Which code segments should you include in Target 1, Target 2, Target 3, Target 4…?

###BeginCaseStudy###
Topic 3, Online Bookstore
Background
You are developing an online bookstore web application that will be used by your company’s customers.
Technical RequirementsGeneral requirements:
 The web store application must be an ASP.NET MVC application written
in Visual Studio.
 The application must connect to a Microsoft SQL database.
 The GetTop100Books() method is mission critical and must return data
as quickly as possible. It should take advantage of fast, forward-only, read-only
methods of reading data.
 The ImportBooks() method must keep a copy of the data that can be
accessed while new books are being imported without blocking reads.
 The Create MonthlyTotalsReport() method must lock the data and
prevent others from updating or inserting new rows until complete.
 The college textbook area of the web application must get data from a
daily updated CSV file.
 The children’s book area of the web application must get data directly
from a local database. It must use a connection string. It must also support
access to the stored procedures on the database. Further, it is required to have
strongly typed objects. Finally, it will require access to databases from multiple
vendors and needs to support more than one-to-one mapping of database
tables.
 The cookbook functionality is contained within a client-side application
that must connect to the server using HTTP and requires access to the data
using JavaScript.
 The BookApiController class must have a method that is able to perform
ad-hoc queries using OData.
The RESTful API of the bookstore must expose the following endpoints.

Application Structure

PurchaseOrders.xml

FeaturedBooks.xml

###EndCaseStudy###

DRAG DROP
You need to update the GetBook() method to retrieve book data by using ADO.NET.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and Target 5 to
complete the code? (To answer, drag the appropriate code segments to the correct targets in the
answer area. Each code segment may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.)

###BeginCaseStudy###
Topic 3, Online Bookstore
Background
You are developing an online bookstore web application that will be used by your company’s customers.
Technical RequirementsGeneral requirements:
 The web store application must be an ASP.NET MVC application written
in Visual Studio.
 The application must connect to a Microsoft SQL database.
 The GetTop100Books() method is mission critical and must return data
as quickly as possible. It should take advantage of fast, forward-only, read-only
methods of reading data.
 The ImportBooks() method must keep a copy of the data that can be
accessed while new books are being imported without blocking reads.
 The Create MonthlyTotalsReport() method must lock the data and
prevent others from updating or inserting new rows until complete.
 The college textbook area of the web application must get data from a
daily updated CSV file.
 The children’s book area of the web application must get data directly
from a local database. It must use a connection string. It must also support
access to the stored procedures on the database. Further, it is required to have
strongly typed objects. Finally, it will require access to databases from multiple
vendors and needs to support more than one-to-one mapping of database
tables.
 The cookbook functionality is contained within a client-side application
that must connect to the server using HTTP and requires access to the data
using JavaScript.
 The BookApiController class must have a method that is able to perform
ad-hoc queries using OData.
The RESTful API of the bookstore must expose the following endpoints.

Application Structure

PurchaseOrders.xml

FeaturedBooks.xml

###EndCaseStudy###

DRAG DROP
You need to update the GetBook() method to retrieve book data by using ADO.NET.
You have the following code:

Which code segments should you include in Target 1, Target 2, Target 3, Target 4 and Target 5 to
complete the code? (To answer, drag the appropriate code segments to the correct targets in the
answer area. Each code segment may be used once, more than once, or not at all. You may need to drag
the split bar between panes or scroll to view content.)

Answer:



Leave a Reply 8

Your email address will not be published. Required fields are marked *


Miguel Costa

Miguel Costa

2 – “SELECT id, name FROM Books Where id = @id”

a

a

someone must be joking with us….this is all wrong

1 – cmd.parameters.addwithvalue(“@id”, id)
2 – select … @id
3 – conn.open() (open it when you need it, not before)
4 – id … getint32 (not freaking guid…that’s a dead giveaway)
5 – getordinal(‘name’)

nex-54

nex-54

1,3 order doesn’t matter. All other is as you said.

Andrii

Andrii

Actually it matters, Miguel is right – why do you need to open a connection if you’re not using it right away?

Andrii

Andrii

a, not Miguel 🙂

Andrea

Andrea

1 – OK
2 – “SELECT id, name FROM Books Where id = @id”
3 – OK
4 – ‘id’
5 – ‘name’