Using Transaction concept to save changes or Rollback changes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 лет назад
Hello,

I am trying to add shipment and shipment items to database and I want to commit those changes to database only when all the shipment items are added. Due to any application failure, if any one of my shipment items doesn't get added, I want to rollback the changes. So for this I am trying to use transactions concept. I just want to know whether there is any implementation for Transactions in the EF code that I can use. And if yes, Can you please give me a sample on how it can be achieved.

Thanks!!
6 лет назад
Hello,

EF6 supports transaction scope. You may see additional information on https://msdn.microsoft.com/en-us/data/dn456843 page.

If it won't work, you can try using elder TransactionScope class - https://msdn.microsoft.com/en-us/library/bb738523(v=vs.100).aspx.

The first approach is recommended by Microsoft.
6 лет назад
Thanks for the guidance. It helped.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.