Question

I'm trying to visualize a 3-layer design with Entity Framework.

If I have a Repository on top of the EF Context, are they both components of the Data Layer?

Or is the Repository the Data Layer itself, and EF something else?

I'll have a BLL that communicates with the repository or Data Layer (I have no clue..) and I'm trying to figure out how this all fits together.

Was it helpful?

Solution

I would call a repository on top of EF a Data Layer Abstraction. I would not visualize it as a separate layer. The repository is the Data Layer.

Otherwise you could start to say that EF itself is a Data Layer Abstraction because it's an ORM supporting many database systems and is an implementation of the Repository and Unit of Work pattern itself. You would end up to say that you have a database as the Data Layer and a data layer abstraction in form of the ORM called EF and then a second-level abstraction in form of your custom repository on top of EF.

The layer which manages the access to the data storage in your application is the Data Layer - and that is your repository. EF and the database is just a detail of this layer, I'd say.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top