Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Entity Framework as Data Access Layer

In my ASP.NET application I want to implement by data acess layer using the Entity framweok so I can use it as an ORM tool. But I dont want the rest of the application to care that I'm using this or be polluted by anything entity frameowrk specific.

I cant seem to find anyone who is using the entity framework exclusively in their Data access layer so I'm keen to see any online examples of this/ experience people have.

like image 982
AJM Avatar asked May 27 '09 13:05

AJM


People also ask

Is Entity Framework a data access layer?

Entity Framework is a data access layer. Specifically it's an Object Relational Mapper.

How do you create a data access layer using Entity Framework?

Select your project in the VS Solution Explorer window and press CTRL+SHIFT+A to add a new item. Search for the ADO.NET Entity Data Model item, then click “Add” to proceed. After the ADO.NET Entity Data Model component is added, it will automatically pop up its Data Model Wizard.

Which block of .NET framework is also called data access layer?

The recommended approach, however, is to separate the data access logic from the presentation layer. This separate layer is referred to as the Data Access Layer, DAL for short, and is typically implemented as a separate Class Library project.


2 Answers

http://ayende.com/Blog/archive/2007/06/08/Rhino-Commons-RepositoryltTgt-and-Unit-Of-Work.aspx

Look at the above example, you can implement entity framework in the same fashion using repository pattern

like image 129
Srikar Doddi Avatar answered Sep 21 '22 05:09

Srikar Doddi


You could abstract the entity framework using something like the repository pattern like ScottGu does with Linq in the NerdDinner series.

http://nerddinnerbook.s3.amazonaws.com/Part3.htm

like image 20
Greg B Avatar answered Sep 23 '22 05:09

Greg B