Click here to Skip to main content
14,697,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

This one is a general question.
I am writing a new web application using visual studio 2010, framework 4.

I want to use entity framework AND using layers model:

1. Application layer (UI)
2. Business Logic layer (gets the parameters from the UI, and prepare them for the data layer)
3. Data layer (executes the query \ stored procedure)
4. entities layer - this layer should be visible in all layers. the data layers returns an entity, the application layer sends it to the business logic, business logic might change it...

The entities should be mostly same as tables from DB, but - in some cases I would like to add an additional field, or create a brand new entity which will include some other entities, or collection.

Is it possible using Entity Framework. If so, in which layer should I generate the entities and how should I do that?

(I found this page:[^]
but it doesn't have an entities layer)

Updated 22-May-12 2:08am
Jim Jos 22-May-12 6:11am
Normally entities will sit in the data layer and Entity is nothing but an ORM to the real DB. You can do your own fields / new entity out of existing entities etc..
DanaH85 22-May-12 7:07am
I want the data layer to be able to retrieve also entities from the entities layer (Even if it had additional fields). Is it possible the way you're suggesting?

1 solution

You have already answered your question. Your Entity classes can be placed in a separate library that can be shared between the others. The Data layer can contain the ObjectContext methods.

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