Quantcast
Channel: patterns & practices: Project Silk
Viewing all articles
Browse latest Browse all 93

New Post: IUnitOfWork in project silk

$
0
0
They did it so they could use Unity to inject a DBContext into the repositories. DBContext doesn't otherwise implement an interface, although it does have a SaveChanges method already so technically already implements IUnitOfWork. But they really need to DI that reference to the DBContext into the repositories, so they wrote a hack. The whole BaseRepository falls apart if the IUnitOfWork implementation you give it isn't a DbContext.

So in essence, while pretending to be using DI to loosely couple the repositories and the DBContext, they just mask the tight coupling. The worst of both worlds!

Viewing all articles
Browse latest Browse all 93

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>