Click here to Skip to main content
15,885,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
what is the difference between the DAO and repositery , how they are used in the project..
and also what is the relation between DAL,DAO,Repositery.
Posted
Updated 7-Feb-13 18:53pm
v2

1 solution

DAO is an abstraction of data persistence. Repository is an abstraction of a collection of objects.

DAO would be considered closer to the database, often table-centric. Repository would be considered closer to the Domain, dealing only in Aggregate Roots. A Repository could be implemented using DAO's, but you wouldn't do the opposite.

Also, a Repository is generally a narrower interface. It should be simply a collection of objects, with a Get(id), Find(ISpecification), Add(Entity). A method like Update is appropriate on a DAO, but not a Repository - when using a Repository, changes to entities would usually be tracked by separate UnitOfWork.

It does seem common to see implementations called a Repository that are really more of a DAO, and hence I think there is some confusion about the difference between them.


see below links for more info
http://msdn.microsoft.com/en-us/magazine/dd419654.aspx[^]
http://www.codeinsanity.com/SystemMessages/FileNotFound.aspx[^]
http://blog.fedecarg.com/2009/03/15/domain-driven-design-the-repository/[^]

http://devlicio.us/blogs/casey/archive/2009/02/20/ddd-the-repository-pattern.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900