Microsoft
70-516 · Question #215
70-516 Question #215: Real Exam Question with Answer & Explanation
Sign in or unlock 70-516 to reveal the answer and full explanation for question #215. The question stem and answer options stay visible for context.
Question
You have an existing ContosoEntities context object named context. Calling the SaveChanges() method on the context object generates an exception that has the following inner exception: System.Data.SqlClient.SqlException: Cannot insert duplicate key row in object 'dbo.Colors' with unique index 'IX_Colors'. You need to ensure that a call to SaveChanges() on the context object does not generate this exception. What should you do?
Options
- AExamine the code to see how Color objects are allocated.
- BAdd a try/catch statement around every call to the SaveChanges() method.
- CRemove the unique constraint on the Name column in the Colors table.
- DOverride the SaveChanges() method on the ContosoEntities class,
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.