I have an interface IRepository and an implementation EFRepository.
I use structuremap injection in order to get the repository implementation.
Right now the EFRepository has constructor with no parameter so structuremap knows to retrieve instances on EFRepository easily.
Now I need to change the repository implementation so that it will recieve in the constructor parameter that holds the unit of work.
My question in such case, how I use structuremap in order to return an instance that initialized with the unit of work?
EXAMPLE
Until today I used:
using(IUnitOfWork uow=UnitOfWork.current) {
IRepository rep = ObjectFactory.GetInstance<IRepository<T>>();
//repository operations that uses UnitOfWork.current that initialized above
}// here dispose of UnitOfWork.current
Now I want to use:
using(IUnitOfWork uow=new UnitOfWork()) {
//Not sure is this is how I tell sructure map to use contractor that
//get IUnitOfWork)
IRepository rep = ObjectFactory.GetInstance<IRepository<T>>(uow);
//repository operations that uses uow that initialized above
}// here dispose of UnitOfWork