There are several overrides available in DO like OnRemoving(), OnRemove(), OnValidate() but how do I prevent an entity from being removed as a function error. I've now implemented the OnRemoving() where I throw a custom Exception but it would seem not to be the appropriate place to do that kind of validation. When however I do it in the OnValidate() I get an Exception saying 'The entity is removed'. It's the good old chicken-and-egg problem again. Can not Validate an entity that is removed in the OnValidate() override.

Regards Paul

asked Jun 03 '13 at 01:54

Paul%20Sinnema's gravatar image

Paul Sinnema

Hello Paul,

could you please provide some code examples? I think DataObjects.Net should properly handle deletions with validation. In other words if entity is removed it should not be validated anymore.

(Jun 06 '13 at 03:02) Denis Krjuchkov Denis%20Krjuchkov's gravatar image

Hi Denis, I think you misread. It's not that we want to Validate the Entity. We want to prevent Entities from being removed in some cases.

(Jun 06 '13 at 03:40) Paul Sinnema Paul%20Sinnema's gravatar image

Ok, the Business case is like this:

  • We import activities from our MOS application.

  • After import one can add new activities manually

  • Manually added activities may be removed. Imported ones not.

(Jun 06 '13 at 03:43) Paul Sinnema Paul%20Sinnema's gravatar image

This one still needs an answer!

(Jun 27 '13 at 01:27) Paul Sinnema Paul%20Sinnema's gravatar image

Hello Paul. I'm really sorry for such delay. Could you please contact us in Skype for further discussing of your problem?

(Jun 27 '13 at 05:15) Denis Krjuchkov Denis%20Krjuchkov's gravatar image
Be the first one to answer this question!
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


Once you sign in you will be able to subscribe for any updates here



Asked: Jun 03 '13 at 01:54

Seen: 46,502 times

Last updated: Jun 27 '13 at 05:15

Related questions

powered by OSQA