DTO's vs. LLBL Entities

Posts   
 
    
KastroNYC
User
Posts: 96
Joined: 23-Jan-2006
# Posted on: 27-May-2007 20:06:19   

I'm trying to weight the differences between implementing a solution using DTO's between the presentation and the service layer or simply allowing each layer to have knowledge of LLBL Entities.

It seems that if I want to use DTO's (which I do for a future web service layer, there just so simple to serialize without all of the added features of an Entity) I'll need to implement most of the features of an entity (tracking new, dirty), create some type of UnitOfWork for DTO's, etc.

What is the consensus to this, do you think it is worth it to generate the DTO layer and then create the functionality for a DTO UnitOfWork and implement tracking on the DTO objects or just use the Entities provided in the framework?

-Kas

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 28-May-2007 09:23:39   

What is the consensus to this, do you think it is worth it to generate the DTO layer and then create the functionality for a DTO UnitOfWork and implement tracking on the DTO objects or just use the Entities provided in the framework?

IMHO, DTO might be a good option for light wieght transferring of data. But if you want to use it, it won't be a good idea to re-invent the wheel and implement all the functionality of the entity objects. Otherwise use the entity objects instead.

It's your call which functionality to implement in the DTOs, but the fewer the better.

For example: State can be managed by using different web-service methods. (i.e. instead of having a method called "Save" you should have to methods called "Insert" & "Update" for different entities statuses).

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 28-May-2007 09:30:45   

The only time that I use DTOs is when I need to interoperate with non-.NET apps OR when I dont control both sides of the application.

Normally, when I dont control both sides of the application, I create services for the consumers, and this is where DTOs come into play.

npathuru
User
Posts: 17
Joined: 14-Jun-2005
# Posted on: 04-Jun-2007 17:40:10   

Can anyone please explain in a step by step fashion, how to create a seperate DTO Project using Pro. Will really appreciate help. Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14983
Joined: 21-Aug-2005
# Posted on: 05-Jun-2007 09:32:47   

There is a DTO template posted here: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=6261

Some complimentry threads, who faced minor problems using the above template: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8800 http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=8029

Good Luck