What is the role of DAOs (Data Access Objects)?
I have a question on data access. Why are DAOs (Data Access Objects) used to run queries against the database? I thought that this was the job of the Repository?
I am going through the Design Pattern Framework's MVC application. The controller calls the Repository and the Repository calls the Service. Then in the service a Data Access Objects are called to retrieve data Why is it done this way?
Am I missing something? Why is there a Repository Pattern?
Any comments would be appreciated.
Brendan Vogt, Jan 04, 2011
I would suggest you to read http://www.primaryobjects.com/CMS/Article108.aspx for understanding Respositry pattern.
Raghu Raghavan, Feb 01, 2011
To make design Loosely Coupled!
Mohammed Sarfaraz, Jan 23, 2011
Rather than The Controller => Repository => Service the following is more flexible approach
Controller => Service => Repository => Data Access Engine
Because, the service should be the entry point into your app and this will help you in case where request is coming from different clients like web, portable device, smartclient etc....to manage all the logic at one place rather than splitting between repository and services.
A good writeup on repository pattern can be found here http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/10/08/the-repository-pattern.aspx
Hope this helps.
Rajesh Pillai, Jan 10, 2011