My entity classes as DTOs

Posts   
 
    
cabral avatar
cabral
User
Posts: 16
Joined: 24-Oct-2005
# Posted on: 25-Oct-2005 15:37:24   

Hi

I have been testing LLBL and I am not sure where exactly my automatically created Entity classes fit into a good n-layer scenario. I have read some good books on multi-tier architectural designs, like "Patterns of Enterprise Application Architecture", by Martin Fowler.

One of my questions would be if my Entity classes should be only DTOs (Data Access Objects), as described by Fowler. According to his definition of DTOs, these classes would only be containers of data, with their gets and sets. Within this concept, I would have to build my own custom business objects to deal with that data and leave the Entity classes created by LLBL unchanged, right?

For example, I create an Order business class which encapsulates my OrdersEntity class, with some methods for calculating delivery fees, etc. Inside this Orders class, I would have a reference to my OrdersEntity, FeesEntity, CustomerEntity, etc. Then, if I want some of the properties of the Orders exposed to clients, I would map them into the OrdersEntity class. This way, I would expose to clients only the properties I want.

How about my UI (a web page, por example)? It would have access to the OrdersEntity class as DTOs, right? Would that be risky, because I would expose some properties that maybe I wouldn't want?

I confess I am a little confused about how to set things up. For what I have read, it just doesn't seem correct that I simply start adding methods to my generated Entity classes...

I would like to hear from you guys what you have been doing...

Thanks!

MacDennis avatar
MacDennis
User
Posts: 50
Joined: 03-May-2005
cabral avatar
cabral
User
Posts: 16
Joined: 24-Oct-2005
# Posted on: 26-Oct-2005 19:28:42   

Thanks, MacDennis!

I learned a lot from the discussion in that forum, I just regret that people are no longer discussing it.

I have read some books on architectural design and I think there are really many possible choices, each of which are adequate for different purposes and requirements. A 6-layer architecture, for example, would not be necessary for a small and simple system.

I think it would be interesting if people started to tell their stories and choices in this forum and why each one decided to go in that direction, why some choices were discarded, etc.

Well, I hope to hear from everyone of you! In my next post I will explain what we have decided and we can discuss it...