Best Practice for Concurrency Conflict Resolution?

Posts   
 
    
Emmanuel
User
Posts: 167
Joined: 13-Jan-2006
# Posted on: 28-Jun-2016 19:19:13   

What is the best way to resolve concurrency conflicts when using LLBLGen (v5 against a SQL Server database)?

I wrote a test app and I see that an ORMOutOfSyncException is thrown. To be able to present the user with a list of entities and fields in their graph to be saved that conflict with server versions, how should I proceed? Specifically:

1) What is the best way to determine which entities in the graph to be saved conflict with the server? I see a lot of information in the ORMOutOfSyncException but don't know how to use it.

2) What is the best way, once I determine which in-memory entities are either a) out of sync, or b) no longer exist in the database.

3) For the entities which are out of sync (2)a), above), what is the best way to determine which fields are out of sync and what their differences are?

4) I added timestamp fields to all of my entities. How do I tell LLBLGen to use this to quickly determine if an entity being saved might be out of sync?

Thanks!

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 28-Jun-2016 23:48:45   

4) Best way is to implement the IConcurrencyPredicateFactory, please check Concurrecny Control

1) Using the above you shall receive ORMConcurrencyException, which has a property "EntityWhichFailed".

2) What is the best way to do what? you didn't specify. I assume informing the user, so it's a BL/UI matter.

3) Fetch the entity again to a different object and do the comparison.