views:

14

answers:

0

Hi everyone. Here is the situation:

Lets's imagine we have table A in the database and we've created Entity model for that table. Let's also imagine that there are several Uniqeu and Foreign constraints in that table.

Now let's do the following:

  1. load more than 1 record from that table into the context.
  2. Change some objects to make some constraints be violated
  3. SaveChanges in the context.

We will receive SqlException that will say that some constraints were violated.

The question is - can we get the object that triggered that constraints violation from the context (to show friendly message for user e t.c.)

Thanks in advance