MongoDB - register each collection instead of repositories registration


Hi. I noticed that in Distributed.NetShop you register each MongoDbRepository like:


The MongoDbRepository ctor expects IMongoDatabase and collection name as System.String.

My question is: Are there any pros from registering each collection instead of each repository ? Then the constructor will look like:

public MongoRepository(IMongoCollection<TEntity> collection)
       Collection = collection;

Is it a good move at all ?

Thanks for reply.


Yes, we want to pass a string here and inject the IMongoDatabase, simply due to the proper lifecycle management via IoC container.