Base solution for your next web application
Open Closed

Unit of Work Behavior for multiple databases #1022


User avatar
0
liaquathussain created

i have a scenario where i will be working with multiple dbcontexts mapped on separate databases. i just want to confirm that if i use UnitOfWork on AppService Method to roll back both transactions if some data occurs. would that work as expected?


3 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    Yes, it will rollback both. But you need MSDTC be enabled in the server since it's required for distributed transactions.

  • User Avatar
    0
    liaquathussain created

    thank you Windows Azure does not support MSDTC yet. any workaround for that ?

  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    If you have 2 dbcontext, .NET requires MSDTC. The only way is to disable transaction as I know. This is a general topic (not directly related to AspNet Zero) and you may find on the web more.