Hi, Our legacy works with LINQ to SQL and our new development is going to use DO. This means that when we want to update both system simultaniously we might get currupted data when 1 of the 2 transactions fails. Now there are 3 possible solutions to this problem:
So my question is: What is the best way to synchronize 2 databases with different technologies involved? Regards Paul |
Hello Paul, it's hard to give universal advice without detailed knowledge about all involved systems. 2-phase commits are difficult to deal with. I'd better avoid them if possible. If your legacy DB and your DataObjects.Net DB are on the same server you could simply use one transaction for applying changes. If it's tolerable to have databases to be out of sync for some short delay you might consider implementing async approach when changes in one database are logged and then applied to other. |
In our case we use TransactionScope and DTC for combine LINQ to SQL and DO with same mssql db. DTC supports scenarios with different databases, different sql servers, different servers and wcf (you can even combine with ntfs transactions). DTC have limitations (nested transactions unsupported, in failure case you can only rollback all transactions and etc). Reprocessing extension take care all these limitations. P.S. if LINQ to SQL and DO use same tables, then you must save all changes and reload entities (if logic can change them) when switching ORM |