You also have the ConflictMode
enumeration and the ChangeConflictException class. These three enumerations are discussed in the
following sections.
ConflictMode
The ConflictMode enumeration can be used in conjunction with the SubmitChanges method of the
DataContext class. This enumeration lets you specify how you want conflicts to be reported when they
are detected. It has two values:
??‘ ContinueOnConflict??”All database updates are attempted; concurrency conflicts are collected
and returned at the end of the change process.
??‘ FailOnFirstConflict??”Update attempts should immediately stop when the first concurrency
conflict is found.
Using the ConflictMode enumeration is quite simple. The SubmitChanges method has an overload that
accepts the enumeration as shown in this code fragment:
Db.SubmitChanges(ConflictMode.ContinueOnConflict);
264
Chapter 13: More about Entity Classes
The ConflictMode enumeration has the following member values:
??‘ FailOnFirstConflict??”Attempts to update the database should cease immediately when the
first concurrency conflict is found.
Pages:
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426