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
|
After an Optimistic Concurrency Exception, I would like to present the user with a field level comparison of the conflicting records to allow the user to make corrections and save.
I can handle the UI stuff but what does LightSpeed have to offer that will allow us to find the conflicting fields?
Presently, my idea would be to loop through the modified entities in the UOW, then grab the LockVersion value and compare it with that stored in the db, and then if different I would grab that row from the db and use reflection to compare the values at a field level.
Your thoughts?
|
|
|
There isnt anything directly in LightSpeed to show what the conflicting row values hold so I think what you have suggested sounds like a reasonable way to go about it. Instead of checking the LockVersion however you could just create a seperate UnitOfWork and reload the entities you were persisting to get a fresh load from the database and then perform a comparison between the properties in each to determine what is different, that would likely save you the extra round trips to the database.
Jeremy |
|
|
Is there a way to populate a new UOW with fresh data based on another UOW? Thanks |
|
|
Try something like: foreach (Entity entity in originalUnitOfWork) { Entity refreshedEntity = secondUnitOfWork.FindById(entity.GetType(), entity.GetId()); // perform a property level comparison here }
Jeremy |
|