tags:

views:

84

answers:

3

Consider the following code:

try
{
    using(TransactionScope)
    {
       Process.Start("SQLInstaller.EXE");
       throw new Exception();
       Commit();
    }
}
catch(Exception ex)
{
//Do something here
}

Will the changes made by SQLInstaller.exe be rollback in this scenario? More specifically, will the changes made by an external process launched through Process.Start() be handled by TxF?

Thanks!

A: 

Doubtful. The external process has absolutely no knowledge of your transaction scope. If you were the coder of the external process and had a way to pass around the transaction handle, sure, but in this case, highly unlikely.

Jesse C. Slicer
A: 

Everything will depend on how the file handle is obtained. If you open the file with a simple File.OpenWrite or any of the standard .NET file manipulation methods then you can be pretty sure that its access will not be transactional. CreateFileTransacted needs to be used every time you try to open a handle.

Darin Dimitrov
+1  A: 

The starting process will not automagically do its work with transactions.

This is really a question of whether the model is implicit or explicit. We chose an explicit model specifically because an implicit model is extremely hard to reason about. Consider, for example, what it would be like if the created process went off and made an RPC call that didn't pipe the transaction through: would RPC client and server have consistent views of the world?

Short answer: nope.

jrtipton