nerdexam
Microsoft

70-516 · Question #267

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses the Entity Framework. You create the following Entity Data Model. You write the following…

The correct answer is B. While (cust.EntityState = EntityState.Modified) Try. See the full explanation below for the reasoning.

Question

You use Microsoft Visual Studio 2010 and Microsoft .NET Framework 4 to develop an application that uses the Entity Framework. You create the following Entity Data Model. You write the following code. (Line numbers are included for reference only.) 01 Using context As New Model1Container() 02 Dim cust As Customer = context.Customers.First() 03 cust.CompanyName = "Contoso" 04 Dim count As Integer = 0 06 End Using The changes to the cust entity must be saved. If an exception is thrown, the application must retry the save 3 times. You need to add a code segment to meet the requirements. Which code segment should you insert at line 05?

Options

  • AWhile (count < 3)
  • BWhile (cust.EntityState = EntityState.Modified) Try
  • CWhile (True)
  • DWhile (context.ObjectStateManager.GetObjectStateEntry( _

How the community answered

(43 responses)
  • A
    9% (4)
  • B
    81% (35)
  • C
    7% (3)
  • D
    2% (1)

Community Discussion

No community discussion yet for this question.

Full 70-516 Practice