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
|
We have a table with self reference. I.e. Now, when we are creating this chain, we create several (i.e. 5-10) entites in correct order, calling uow.Add() for each and connecting Id with the previous one. Similar situation is at deletion. We delete all entities from chain, but on SaveChanges() order of delete commands is not correct, resulting in "record with child present can not be deleted". |
|
|
Hi guys, Please, is there any feedback on this? |
|
|
Sorry, Marko, we've not had the chance to look at this yet. Looking at the code there does seem to be something there to tackle this scenario but it's not a part of LightSpeed I'm familiar with (and the commit note does seem to imply that it may not handle all cases). I'll work up some test cases and let you know how it goes. |
|
|
Can you confirm that you are relating these entities by setting the XxxId property (the FK), rather than the association property (the entity/EntityHolder)? I can reproduce the problem in the former case but not in the latter case. |
|
|
Ivan, yes, that's correct. We're setting xxxId properties. The reason - this is done in a layer working with DTOs, and hence only properties relating directly to columns are available. From this layer DTO objects are copied to (and from) LS entities via generic methods, and no work is done "directly" with entities. |
|
|
I've committed a candidate fix for this and it will be included in nightly builds dates 2 Mar 2010 and above, available from about 1500 GMT. It's possible the fix could have knock-on effects on other ordering scenarios (it *shouldn't*, but there may be edge cases we've missed), and there may be a performance impact if inserting large numbers of entities into a self-referencing table. Please do let us know if you see any odd behaviour or bugs after applying the fix. |
|
|
We finally found some time to implement the new LS version, and refactor our code to the original idea. Thanks! |
|