How to best use Dapper.rainbow code with transactions? For example, I may do operations that are not supported by dapper.rainbow in the same transaction as dapper.rainbow operations.
Dapper.rainbow Database class has a field private DbTransaction _transaction; that cannot be accessed. This means there is no way to "enlist" the rainbow database in an existing transaction.
There is a method void BeginTransaction() which allows me to create a new transaction. But since it is not returned, I cannot piggyback on top of it.
I was thinking that maybe we need to extend the code base.
- Either by making an overload of
Init() taking a transaction parameter from which the transaction and the connection can be accessed.
- or by creating a method
void EnlistTransaction(DbTransaction tx) { _dbTransaction = tx; }
- Or maybe just expose the transaction variable. The very least make it
protected such that subclasses can access it.
Will this be acceptable? I'm happy to create a pull request if we can agree on a design.
How to best use Dapper.rainbow code with transactions? For example, I may do operations that are not supported by dapper.rainbow in the same transaction as dapper.rainbow operations.
Dapper.rainbow Database class has a field
private DbTransaction _transaction;that cannot be accessed. This means there is no way to "enlist" the rainbow database in an existing transaction.There is a method
void BeginTransaction()which allows me to create a new transaction. But since it is not returned, I cannot piggyback on top of it.I was thinking that maybe we need to extend the code base.
Init()taking a transaction parameter from which the transaction and the connection can be accessed.void EnlistTransaction(DbTransaction tx) { _dbTransaction = tx; }protectedsuch that subclasses can access it.Will this be acceptable? I'm happy to create a pull request if we can agree on a design.