Home  /  Questions  /  Question



50   50
Jan 04, 2011


What is the role of DAOs (Data Access Objects)?

Hi,

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.

Thanks.



1,364   100.0
Jan 10, 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.


60   95.3
Jan 23, 2011
To make   design Loosely Coupled!

50   50
Feb 01, 2011
I would suggest you to read http://www.primaryobjects.com/CMS/Article108.aspx for understanding Respositry pattern.