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 have an entity A with a many-to-one relation to B like A { EntityCollection<B> _b } and B { EntityHolder<A> _a } I then do Repository.BeginUnitOfWork, .Attach(b), CompleteUnitOfWork. To this point everything works OK. Now, the user may decide he wishes to remove the new object b (the object a is not reloaded from the database in this scenario, if it is, then everything works fine) The problem: The object b is removed from the database, but the EntityCollection in a is not updated! So when the user interface refreshes, b is still shown, but it is not existing. When I debug your source code I see that in EntityCollection.cs, OnEntityStateChanged (row 330), entity.UniqueId does not match any key in _entitySet, but _entitySet contains an entity with a UniqueId matching entity.UniqueId. So the key does not seem to be updated to reflect the UniqueId set when the new entity is saved? Could you please have a look at this? Hopefully this is a problem that you can reproduce, otherwise I will set up a test case. Best regards Björn Andersson Admeta AB
|
|
|
Hi Björn, I would be greatful if you could supply a small test case so that I can better understand your scenario and resolve this promptly. Cheers Andrew. |
|
|
Hi! I have tried this morning to produce a test case doing the same thing using your samples code, but in there it works fine. We do exactly the same thing in our code using the same version of LightSpeed. I was hoping the scenario I supplied using only two entities would produce the same error, but it seems as our more complex relationships with different entities messes things up within LightSpeed, or that we do something wrong. However, as I look into your code (I have spent very little time so far as we purchased LightSpeed yesterday after some time of evaluation), there evidently seem to be something wrong when it reaches the codelines I gave you in my previous post, since the key doesn't match the UniqueId of the Entity in the list. So far I don't know why it mismatches, but I will continue debugging your code and see if I can find out something. And try to create a test case. I will inverstigate this further and give you more input when I find any, but could you please have a look also in the mean time? Björn Andersson Admeta AB |
|
|
Hi! I found out why it differs from samples. Our application uses IdentityColumn, not KeyTable. Hope this helps out. Best regards Björn Andersson Admeta AB
|
|
|
I have made a test case. I Hope I made it right :) In Tests/SqlServer2005-vs2005 add this test (sqlServer uses identityColumn in your unit tests): [Test] Best regards Björn Andersson Admeta AB |
|
|
Thanks Björn. We'll take a look and get back to you shortly. Cheers, Andrew. |
|
|
Hi Björn, Thanks for raising this issue. It's fixed in tonight's build. Cheers, Andrew. |
|
|
Great! Thanks! Björn Andersson Admeta AB |
|