views:

142

answers:

1

Hi,

I need to update multiple databases in one transaction using entity framework. Means if we need to insert records in two tables of two different databases and insertion succeeds for first database but fails for other database then insertion in first database should also get rolled back.

Please let me know if we can do this using entity framework.

Thanks

Sharad Rastogi

+1  A: 

Managing Connections and Transactions (Entity Framework)

You can use a TransactionScope to accomplish what you require.

How to: Manage Transactions in the Entity Framework

TransactionScope and ADO.NET Entity Framework

Mitch Wheat
I have two edmx files and don't know how to use transaction scope for the same as all the examples I have seen have only one edmx files. can you provide any sample that shows transaction management usign two data models (edmx files).