I have interface IRepository that maps to the class GenericRepository in unity.
IOC.Container.RegisterType<IRepository, GenericRepository>();
(GenericRepository takes a ObjectContext (Entity Framework context) to perform its data actions)
The problem is that I need several different instances of GenericRepository. (I have several Entity Framework models in my solution)
In each part of the business layer logic I need to resolve IRepository and get a GenericRepository that was initialized for the Model that corresponds to that part of the business layer logic.
I need some way to setup with options... I don't know if this is a problem unique to me or if others have had this too.
Is there a way to tell Unity how to do this?
NOTE: I would prefer not to pass an instance of the ObjectContext in as a parameter to the Resolve method. If I do that then I defeat the purpose for the Repository pattern (abstracting the data layer so I can unit test easily).