Handling Concurrency Conflicts
We have seen how to save data to the database and use transaction objects to save
the data safely into multiple databases. When we save the changes back to the
database, it is not guaranteed that the data will remain the same, since we read it the
last time. There are chances that other users might be using the same application and
will be updating the same information that we are also trying to update.
Optimistic concurrency conflict occurs when we attempt to submit the changes we
made, and at the same time another user has updated the same record. To resolve
this, LINQ to SQL has some properties for the members by which we can easily
find out the members in conflict and then handle it. To detect conflicts when the
application has changed the value of the member, we have to use the property
called UpdateCheck associated with the ColumnAttribute of the member. We can
include the members for detecting the optimistic concurrency conflicts using this
ColumnAttribute with UpdateCheck property.
Pages:
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204