When you try to remove an entity with associations you can get an exception if the OnRemoveAction of an association forbids the removal of a associated entity.

The current message of this exception is : "Referential integrity violation on attempt to remove 'MyClass', Key='MyClass, (8968)'."

Would it be possible to show in the message the entity and the associations preventing the removal?

For instance, "Referential integrity violation (...) MyClass.Items has OnOwnerRemove = OnRemoveAction.Deny and contains MyItem, Key='MyItem, 1234'

asked Oct 13 '10 at 08:56

olorin's gravatar image

olorin
358878792

edited Oct 14 '10 at 09:13

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211


One Answer:

Issue 832 is created.

answered Oct 14 '10 at 04:30

Alex%20Yakunin's gravatar image

Alex Yakunin
29714412

edited Oct 14 '10 at 04:30

Thanks! Not urgent but I'm having an hard time to find what is preventing the removal of one my entity types ;)

(Oct 14 '10 at 08:16) olorin olorin's gravatar image

Well, this doesn't mean we'll implement it ASAP, but it's scheduled for v4.4.

(Oct 14 '10 at 09:28) Alex Yakunin Alex%20Yakunin's gravatar image

Coming back to stress that it is a really important feature for us. We're struggling with objects that have a lot of relations. This feature would be a huge time saver.

(Nov 26 '10 at 05:25) olorin olorin's gravatar image

Olorin,

just an idea: you could try catching ReferentialIntegrityException and get all the requested data from it. It has the following properties:

  • Association (where you can find OnRemove actions)
  • Initiator
  • ReferencingObject
  • ReferencedObject
(Nov 26 '10 at 08:41) Dmitri Maximov Dmitri%20Maximov's gravatar image

Done, exception message now contains all these properties.

(Nov 27 '10 at 08:53) Alex Yakunin Alex%20Yakunin's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA