This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi: I've been playing around with the unitOfWork.Remove(Entity) method and have a question. It appears that if you call Remove on an entity that has a foreign key relationship with another record in the database that it will remove that record as well to ensure consistency. Is there a way to change the behaviour so that it throws an exception in that case. I currently have it working by checking the inverse relation but having it fail would be my preference. The database is MySQL. Thanks. |
|
|
If you set a [RemovalBehavior] attribute on the child side of the relationship and set the action to be NoAction then an exception will be thrown if you try and delete a parent which has active children prior to any database calls being made. Have a look at this thread for some more details on this: http://www.mindscapehq.com/forums/Thread.aspx?PostID=6202
Jeremy |
|