views:

31

answers:

1

Hi,

We're developing a layered web application. The specs:

  • 3 layers, data layer, business layer, ui layer.
  • Programmed in C#
  • Data Layer uses the entity framework

Currently we plan on having the data layer return IEnumerable<T> to the business layer via linq 2 entities, and the business layer will return data to the ui layer.

Since the ui layer has no knowledge of the existance of the data layer, how would it handle a result of IEnumerable passed to it from the BLL, where T is defined in the data layer?

Are there any GOOD example out there on how to do this. Please note that I'm extremely new to factories / interfaces / abstraction to loosely couple layers.

I saw the question here http://stackoverflow.com/questions/917457/passing-data-in-an-ntier-application and it was recommended to have the entity layer shared amongst all layers... however I do not want the other layers to be able to query the database.

+1  A: 

Have your data objects defined in a separate project, or at least a separate namespace, so the Display layer can have a reference to the objects, but not the DAL that has access to the db.

derek
Since the Entity Framework automagically creates the DTO's and my entity data model is in my data layer, how would I go about having Visual Studio create these DTO's elsewhere?
Chris Klepeis
I ended up using T4 to create the DTO's for me.
Chris Klepeis