Reputation: 103
I am interested in the following scenario. There exists a class library that contains a generic repository interface named IRepository. The library also contains multiple implementations of the same interface e.g. UserRepository, ItemRepository and so on. Also I do not able to add external libraries like Unity or other DI containers. My question are:
Upvotes: 2
Views: 108
Reputation: 2016
The best approach is to use Unity container anyway. It allows to do something like that in config file:
<container>
<register type="ILogger" mapTo="EventLogLogger" />
</container>
Or you can do the same by yourself reading config sections and creating instances using reflection at application start up
Upvotes: 1