I have tried your code with the test project you uploaded previously. It inserts/updates records without any errors. What behaviour did you expect to obtain?bairog wrote:1) To emulate nested transactions I should use savepoint inside a transaction, right?
I've made some sample code - is it correct now?
This approach can be used for predefined (existing) databases.bairog wrote:2) Regarding the first approach with one connection and one local transaction ("data source" database + "attached" database):
Since I'm using EF Code-First - I will have one DbContext with all my Entities (from both databases), right?
But I didn't catch how can I make my DbContext know that some of it's DbSet's should be saved in first database and others should be saved in second one. Some special attributes in DbContext initialisation?
UPDATE: the further discussion (message 1 and message 2) proves that EF Migrations can create tables in "attached" databases as well.