How does one share transactions with an SMO server connection? Sharing connections is as simple as
var connection = new SqlConnection();
var serverConnection = new ServerConnection(connection);
var server = new Server(serverConnection);
But if the connection already has an existing Transaction
of its own,
var connection = new SqlConnection();
connection.BeginTransaction();
when I start using the server object
var database = server.Databases[connection.Database];
This gets thrown:
ExecuteNonQuery requires the command to have a transaction when the connection assigned to the command is in a pending local transaction