Reputation: 6598
I'm on a ASP.NET MVC project and I'm using a generic repository on Data Layer.
This app uses 3 differents DataContexts to manage 3 differents databases.
It works great so far.
Now, I'm trying to archieve Unit Of Work and it's working but only if a inject a specific DataContext instance. Is there a way to inject a generic DataContext class and StructureMap instantiates the right DataContext for me?
Thanks!!
Upvotes: 0
Views: 204
Reputation: 7758
Named Instances are going to be your best bet. Register each context with a name representing the database, then you can resolve the correct DataContext with just a name.
Upvotes: 1