I have decided to use ASP.NET MVC for a website project and want to follow some of the best practices being written about.
So, I have separated out the Domain/Model into a separate project, created IRepositories and concrete repositories and have now turned my attention to Castle Windsor as the IoC.
The problem I now face is that for a particular Controller, on the constructor I will now have to pass in multiple IRepository parameters.
My questions are:
- Have I perhaps created too many Repositories - in general, I map 1 repository to 1 entity class to 1 database table. Should my Repositories be containing effectively more than one entity/db table?
- Have I missed the point with IoC's and Dependency Injection, and should I not be concerned with how params are passed into a Controller constructor?
To give some sort of context. Part of the website will show a google map of properties that is searchable by property type (Castle, House, Pub etc), location (postcode, city), opening time etc. So, these searchable components are all separate entities PropertyType, Address.City, Address.Postcode.Lat+Long, OpeningTime.DateTime. Therefore, there are also 3 separate repositories that have to be passed into the SearchController constructor.
This is a simple example but I can envisage many more repository parameters being passed into other controllers in the future.
Hope all this makes sense.
Thanks for any answers or advice.