nerdexam
Microsoft

70-516 · Question #134

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 to create an application. The application connects to a Microsoft SQL Server database. The application uses the following object…

The correct answer is B. Trace.WriteLine(productQuery.ToTraceString()). CHAPTER 8 Developing Reliable Applications Lesson 1: Monitoring and Collecting Performance Data Accessing SQL Generated by the Entity Framework (page 509)

Deploying and Troubleshooting Data Access

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4.0 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 (AdventureWorksEntities advWorksContext = new AdventureWorksEntities()) 02 { 03 ObjectQuery <Product> productQuery = advWorksContext.Product.Where("it.ProductID = 900"); 04 ... 05 } You need to log the command that the query executes against the data source. Which code segment should you insert at line 04?

Options

  • ATrace.WriteLine(productQuery.ToString());
  • BTrace.WriteLine(productQuery.ToTraceString());
  • CTrace.WriteLine(productQuery.CommandText);
  • DTrace.WriteLine(((IQueryable)productQuery).Expression);

How the community answered

(62 responses)
  • A
    6% (4)
  • B
    81% (50)
  • C
    3% (2)
  • D
    10% (6)

Explanation

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

Topics

#ObjectQuery#ToTraceString#query logging#Entity Framework

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice