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
|
Hello. When I remove an entiy, LightSpeed tries to set null in all related entities. I saw this in the log:
07/01/2010 17:33:04 [INFO] SQL I dont want this behaviour, I want that LightSpeed does nothing, I prefer the SQL exception, so I search the help and found the attribute RemovalBehaviour and applied to the EntityHolder's as help says, but no luck, LS does the same. ? Another question (you can put the questions in a FAQ, the will be useful to new users of LS). Is there any way to save only an entity, not all pending changes in a uow? It may sound strange but I begin to find complicated scenarios.
Thank you. |
|
|
Hi Enrique, The RemovalBehavior attribute is used to determine what to do to any dependants when an entity is being removed from the repository, either set references on the dependants to null, or throw an exception because of the dependancy. You can find more details on this in this thread: http://www.mindscape.co.nz/forums/Thread.aspx?PostID=6397 In regards to committing the changes for only a single entity within a UnitOfWork; for what you are trying to do, this would not be possible because your entities are dependant on the original entity. If you do want it to throw a LightSpeed based exception in these cases however, use RemovalBehavior.NoAction on the removal behavior attribute, which would give you the same behavior as if the query was allowed to continue and generate a SQL exception from the FK violation.
Jeremy |
|
|
Hello Jeremy, I understand it but I'am decorating the entity holder with [RemovalBehavior(Action = RemovalBehaviorAction.NoAction)] and its not working, it seems that there is a problem with this attribute or I am using incorrectly. I can prepare an example to reproduce it. Thank you.
|
|
|
No, that should be fine - can you check you are applying this on the child side of the relationship and not to the parent? The exception would then be thrown if you try and remove the parent. If this matches what you are currently doing, then if you could attach a small repro sample of this behavior we can have a look at it.
Thanks! |
|