DTO naming conventions

2,456 views
Skip to first unread message

YankeeImperialistDog

unread,
Oct 19, 2009, 2:12:48 PM10/19/09
to nhusers
i'm really going overbord with DTO's in my quest for the "correct"
way.

what do some of you consider correct for property naming?

given a Customer and CustomerDTO (class)

each with an id and a string for a Name property

Customer.ID
Customer.Name

what would the CustomerDTO properties be?

Thanks
KES

Shane C

unread,
Oct 21, 2009, 3:01:51 PM10/21/09
to nhusers
I create screen and operation specific DTOs. That way they can
contain as much or as little information as needed specific to their
usage.

I also don't use my domain for displaying information on the UI.
Instead I've pulled a few ideas from the Command/Query separation
stuff that's been going on lately.

Regards,

Shane

On Oct 19, 12:12 pm, YankeeImperialistDog <webbuilder...@gmail.com>
wrote:

Kurt

unread,
Oct 21, 2009, 3:09:29 PM10/21/09
to nhu...@googlegroups.com
Thankfully i've had help in the area of not using domain in UI, but i'm still not 100% on how a DTO would be able to fit into NH session tracking? This may be a question based on a false premise, that DTO is two way. I'm still really trying to get a handle on all of it.
 
Thnaks 

--
Kurt Schroeder
EverybodySafe, llc
847-800-7563
www.IKnowTek.com
www.EverybodySafe.com



Learning makes me feel alive.

Sharing what I learn gives my life meaning!

Paco Wensveen

unread,
Oct 21, 2009, 5:20:43 PM10/21/09
to nhu...@googlegroups.com
Why do you create a DTO? Isn't it easier to create NHibernate mapping
for the "smart" customer class?

Shane C

unread,
Oct 21, 2009, 5:44:43 PM10/21/09
to nhusers
We have separate DTOs for the Commands(Change customer address to X)
vs Query (Show me customer details for Customer X). When a command
comes in we just use all of it's information.

The one place where we did have to do some work was in terms of
tracking lists. Our solution was to just have an Add/Remove list on
the command DTO and do the work by hand. I think in the future it'd
be interesting to look at some convention over configuration stuff to
handle the add/remove handling via generics or something.

José F. Romaniello

unread,
Oct 21, 2009, 5:48:39 PM10/21/09
to nhu...@googlegroups.com
Don't build DTO just for the sport.
Why do you need a DTO, give me more context?

I use WPF databinding with my domain entities for instance.. 
I have some DTO's, but I don't use a dto per class


2009/10/21 Paco Wensveen <pac...@gmail.com>
Reply all
Reply to author
Forward
0 new messages