nerdexam
Microsoft

70-516 · Question #70

70-516 Question #70: Real Exam Question with Answer & Explanation

Sign in or unlock 70-516 to reveal the answer and full explanation for question #70. The question stem and answer options stay visible for context.

Question

You have a ContosoEntities context object named context and a Color object stored in a variable named color. You write the following code: context.Colors.DeleteObject(color); context.SaveChanges(); When the code runs, it generates the following exception: System.Data.UpdateException: An error occurred while updating the entries. See the inner exception for detials. ---> System.Data.SqlClient.SqlException: The DELETE satement conflicted with the REFERENCE constraint "FK_PartColor". The conflict occurred in database "Contoso", table "dbo.Parts", column 'ColorId' You need to resolve the exception without negatively impacting the rest of the application. What should you do?

Options

  • AIn the database, remove the foreign key association between the Parts table and the Colors
  • BAdd a transation around the call to the SaveChanges() method and handle the exception by
  • CAdd code before the call to the DeleteObject() method to examine the collection of Part
  • DChange the End2 OnDelete proprety of the FK_PartColor association from None to Cascade
  • EChange the End1 OnDelete proprety of the FK_PartColor association from None to Cascade

Unlock 70-516 to see the answer

You've previewed enough free 70-516 questions. Unlock 70-516 for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Full 70-516 Practice
You have a ContosoEntities context object named context and a... | 70-516 Q#70 Answer | NerdExam