私の作業単位オブジェクトには、接続とトランザクションの 2 つの依存関係があります。トランザクションをバインドするには、接続が必要です。この状況を処理する方法がわからない。
public class UnitOfWork : IUnitOfWork
{
public IDbConnection Connection { get; set; }
public IDbTransaction Transaction { get; set; }
public UnitOfWork(IDbConnection connection, IDbTransaction transaction)
{
this.Connection = connection;
// In order to create the transaction, it needs the passed in IDbConnection.
}
public void Commit()
{
}
public void Rollback()
{
}
}
この状況をどのように処理しますか?
Bind<IDbTransaction>().To<SqlTransaction>();