2

I am new to this concepts data access layer and data access objects.

I wants to the difference between the data access layer and data access object.Please guide me.

matt b
  • 138,234
  • 66
  • 282
  • 345

2 Answers2

7

Data access object is the dao pattern where the data interaction logic is wrapped (encapsulated) inside the dao objects and the behavior is exposed through dao interfaces. Data access layers is more generic and refers to whole set of infrastructure helping to access the database access. Data access layer may contain dao, driver classes and other data access details.

lalit
  • 1,485
  • 2
  • 17
  • 32
0

DAO/Data Access Objects is the name of a Microsoft database library from 1992. Originally used for accessing Jet databases (MS Access), it later added ODBC support

DAL/Data Access Layer is the generic term for the code that sits between the database library and the rest of the application. Around 2001 Sun started calling the DAL "Data Access Objects" because... well I have no idea.

ref:

http://en.wikipedia.org/wiki/Data_Access_Objects

http://java.sun.com/blueprints/corej2eepatterns/Patterns/DataAccessObject.html

Jonathan Allen
  • 68,373
  • 70
  • 259
  • 447
  • So in `.NET Web API`, would you say a controller (containing REST endpoints) constitutes part of the `Data Access Layer`? – Kyle Vassella Oct 22 '18 at 18:35
  • 1
    I normally divide a WebAPI project into the REST Layer, which includes the controllers and other web-related concepts, and the Service or Data Access Layer, which talks to the database. These are actually separate .NET projects, making it easer to test the DAL against the database without the web stuff getting in the way. -- Note, this is based on how I test my code. Your divisions may be different. – Jonathan Allen Oct 25 '18 at 22:42