Click here to Skip to main content
13,201,452 members (71,718 online)
Rate this:
Please Sign up or sign in to vote.
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 7-Feb-13 18:43pm
Updated 7-Feb-13 18:53pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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[^][^][^][^]

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 8 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100