This is in regards to the unit of work pattern. I’ve seen it done two ways now, and I’m not sure which one represents the ‘real’ pattern. I will outline below.
The first way is to inject your unit of work implementor into the repository constructor and injecting a session/context into the unit of work constructor.
The second way is to inject both your unit of work implementor and your repositories with a session/context, and they live separatly so that repositories can be used independantly for fetching operations, or within a using block for transacted updates.
The decision to micro-transactionalize versus macro-transactionalize is going to affect some upcoming projects. Any guidance would be great.
Thanks!