PrepAway - Latest Free Exam Questions & Answers

Which code segment should you insert at line 04?

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to create an application. The
application connects to a Microsoft SQL Server database. The application uses the following object
query to load a product from the database. (Line numbers are included for reference only.)
01 Using advWorksContext As New AdventureWorksEntities()
02 Dim productQuery As ObjectQuery(Of Product) =
03 advWorksContext.Product.Where(“it.ProductID = 900”)
04
05 End Using
You need to log the command that the query executes against the data source. Which code segment
should you insert at line 04?

PrepAway - Latest Free Exam Questions & Answers

A.
Trace.WriteLine(productQuery.ToString())

B.
Trace.WriteLine(productQuery.ToTraceString())

C.
Trace.WriteLine(productQuery.CommandText)

D.
Trace.WriteLine((DirectCast(productQuery, IQueryable)).Expression)

Explanation:
CHAPTER 8 Developing Reliable Applications
Lesson 1: Monitoring and Collecting Performance Data
Accessing SQL Generated by the Entity Framework (page 509)


Leave a Reply