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 am trying to do some generic optimistic concurrency exception handling with LS 3 and usage of entity change tracking. Main requirement is to deal with concurrency exceptions according to what is apropriate in specific situations (i.e. if 3rd person and current person changed different columns, and item is valid after merging these values, allow save to happen without special user intervention). Now, for this to happen, my idea was to get from UoW something like PendingChanges with a list of entites which were sent for update. Or alternatively, and possibly a more sensible approach, OptimisticConcurrencyException could possibly also contain information about which entity caused the exception to happen. I am not sure if any of this is currently available (I can not find it). And, if it is non-existing, is it possible to persuade you that this is a very nice feature to implement? :) |
|
|
Hi Marko, Absolutely the ideal solution is for the OptimisticConcurrencyException to tell you which entity is at fault. It was on the todo list LightSpeed 3.0 however it wasn't a high priority and I investigated this change initially and found it was going to be quite a mission to implement due to where the exception gets thrown (in the guts of the SQL executing code - not where we have access to the entity and due to batching we cannot catch the exception higher up and know which entity caused the issue). Having said that, I'll have another review of this situation tomorrow as it was about six months ago that I last looked and approaching it with fresh thinking may help find a better solution. I'll post comment on the pending changes collection in your other forum post that you just made :-) I'll update this thread tomorrow after having another look at the OptimisticConcurrencyException changes again. John-Daniel Trask |
|
|
Hi guys, OK, now I'm trying to use new LS 3 feature - collection of attached entites, to resolve optimistic concurrency exception. The basic idea is: at exception, find all entities from UoW which have status Modified and get in new UoW the current copy from DB to compare lockversions, detect which entity caused exception and do some exception resolving. Now, with this new feature, I could go as far as "compare lockversions". As this concurrency resolving is done in a base method, I am not sure how to get "lockversion" value from Entity as I am working only with base Entity class in there. I could maybe do it with some reflection, but wanted to ask is there a nice way to get that LS special value - "LockVersion" (like I can easily get Id by switching to Entity<int>) |
|