Search code examples
dto

BestPractice: May a DTO have navigation properties?


May a DTO have relations to other DTOs?

Any more opinions on this topic :-) ?


Solution

  • The point of a DTO is to allow simple transfer of data between two processes, to reduce method calls.

    Therefore, you'd expect to see a small number of DTOs, sometimes even one DTO, in any interface. Normally, they'd be very coarse-grained.

    I'd be suspicious that DTOs with lots of relationships weren't DTOs at all. And that they were too closely matching your domain objects.

    Can you post some examples?