[Question] Unit of work lifetime
gideonkorir opened this issue · 2 comments
gideonkorir commented
Hi,
I'm going through the code and wondering if all the repositories created during IUnitOfWork.Complete()
are re-using the same IUnitOfWork
instance; otherwise it looks like new events generated by aggregates that are handling the original event will not be dispatched (well until the change feed gets to them).
jbogard commented
Ahhhh I think with using StructureMap it defaults to a single instance per scope.
gideonkorir commented
Checked StructureMap docs n the default is Transient. The ServiceFactory
instance passed to the dispatcher will call IContext.GetInstance
which I think will create a new scope and therefore we'll get new instances of IUnitOfWork
. Haven't been able to run the solution though so can't confirm.