Wednesday, February 13, 2013

Entity Framework : Managing Concurrency

When multiple users try to update the same record simultaneously and system is not having the concurrency control, then users can lose their recent update data, it is called the data concurrency issue and to avoid the this situation, Entity framework is already provide the Optimistic control to handle the concurrency issue.



There are basically 3 types of concurrency controls:
1.       Optimistic Concurrency : Record will be available for user only read , if it holds by some other user
2.       Pessimistic Concurrency  : Record will not be available for user only read , if it holds by some other user
3.       "Last in wins  : None Concurrency
Entity framework is already providing the Optimistic control to handle the concurrency issue and it provides two types of concurrency modes:
·    None – This is the default and means the property is not involved in any concurrency checks
·    Fixed – Which means that the original value of this property is sent as part of the WHERE clause in all updates or deletes.

Managing Concurrency Mode
Managing Concurrency Mode


Simply, we will apply the attribute ConcurrencyMode="fixed” to entity property (timestamp property would be best choice) to handle the concurrency issue .

Thanks for visiting!


Other entity framework releated links :
Entity Framework : Bulk Update

No comments:

SQL Server - Identify unused indexes

 In this blog, we learn about the index usage information (SYS.DM_DB_INDEX_USAGE_STATS) and analyze the index usage data (USER_SEEKS, USER_S...