Concurrency & EnterpriseLybrary RRS feed

  • Question

  • How to dial concurrency using Enterprise Library?


    I was using an Adatper and the adapter throws an exception if the number of updated records is  different to the number of changed records. And with this Exception “DBConcurrencyException ex” I was able to get the rows with concurency problems with “ex.Row”.


    Now I am migrating to SCSF & Enterprise Library and using the function „UpdateDataSet” I have no exception!


    So I am doing the following after calling the function “UpdateDataSet”:


    DataTable dt = _DS.Tables[0].GetChanges(System.Data.DataRowState.Deleted);

    if (dt != null)

                // Do something


    And So on for the deleted, added, and Modified rows


    Is there a better way to deal concurrency using the Enterprise Library?



    Sunday, July 8, 2007 1:44 PM


  • The concurrency problem you describe often surfaces itself when multiple users are working against the same data at the same time. Optimistic locking, the kind most commonly used suffers from this problem. Pessimistic locking does not (granting the fact that the application-level lock needs to be handled optimistically).


    In other words, you still have the concurrency problem - you just haven't run the right scenario for it to rear its ugly head again.


    There is really only one simple way to handle this, and I've written about it in this post titled Realistic Concurrency.


    Let me know if you have any further questions.

    Sunday, July 8, 2007 7:51 PM