Invokation of MySqlBulkLoader.Load() inside Transaction throws InvalidOperationException with message "The transaction associated with this command is not the connection's active transaction.".
m_database.Connection.Open();
var tr = m_database.Connection.BeginTransaction();
var bl = new MySqlBulkLoader(m_database.Connection)
{
SourceStream = new MemoryStream(m_memoryStreamBytes),
TableName = m_testTable,
};
bl.Load();//InvalidOperationException is throwed here
tr.Rollback();
Due to code from MySqlBulkLoader.LoadAsync
var commandString = BuildSqlCommand();
var cmd = new MySqlCommand(commandString, Connection)
{
CommandTimeout = Timeout
};
And code from MySqlCommand.IsValid
public MySqlCommand(string commandText, MySqlConnection connection, MySqlTransaction transaction)
{
CommandText = commandText;
DbConnection = connection;
DbTransaction = transaction;
m_parameterCollection = new MySqlParameterCollection();
CommandType = CommandType.Text;
}
And
else if (DbTransaction != Connection.CurrentTransaction)
exception = new InvalidOperationException("The transaction associated with this command is not the connection's active transaction.");
This exception will be throw always when MySqlBulkLoader.Load will be invoked inside transaction.
There are some workarounds to fix this issue?
Or do I do something wrong?
Invokation of MySqlBulkLoader.Load() inside Transaction throws InvalidOperationException with message "The transaction associated with this command is not the connection's active transaction.".
Due to code from MySqlBulkLoader.LoadAsync
And code from MySqlCommand.IsValid
And
This exception will be throw always when MySqlBulkLoader.Load will be invoked inside transaction.
There are some workarounds to fix this issue?
Or do I do something wrong?