Transactional behavior when updating a DataTable
Steve wrote, "I was checking out Transactional behavior on DataTables, and that's some good stuff. Did you ever come up with a good workaround?"
We already had our own DataViewWrapper class that inherited from DataView, which we were using to catch the Changed events and republish them with more information. We then created a custom "Transaction" object, that keeps a static count of how many Transactions currently exist (it implements IDisposable for deterministic destruction). Now the DataViewWrapper can check if we are in a transaction. If so, we don't publish the changed events. When the last Transaction is disposed, we publish any pending changed events. As a later optimization, we could intelligently combine changed events. It takes more code than I would like, but it works.