2

I have several specific repository classes and I want to share the same db context among all repositories. For now i am creating new context per each repository. I am thinking to use mvc.unity. I dont see very useful example about sharing the db context. Just want know the experts opinions before implementing that.

Thanks,

Tepu
  • 1,262
  • 2
  • 16
  • 26

1 Answers1

1

I would take a look at structuremap for a DI container and scope your dbcontext on the request level so all the repositories that are invoked in the same request get the same instance.

The kind of application that you're building is very usefull to provide a good answer though.

thekip
  • 3,536
  • 2
  • 18
  • 39