Quantcast
Channel: CSLA .NET
Viewing all articles
Browse latest Browse all 764

The proper way of using DTOs?

$
0
0

Hi,

I've Always tried to make dto's correspond to a table in the database I'm using. But is it fair to say that a dto should rather correspond to the Query I'm using instead? Let's say you have a Reservation table, and then a ReservationDto which includes the fields Id, FacilityTypeId, StartDate, EndDate. where FacilityTypeId in the table is a foreign key to the FaciliType table from where I get the FacilityTypeName.

If I should be strict in using dto's to mirror the tables, then I also have to have a FacilityTypeDto in this scenario, but if I instead let my ReservationDto correspond to my Query, which uses a JOIN with my FacilityType table to get the FacilityTypeName I only have to Query the database for information once, hence making the whole thing simpler imo.

It would just be interesting to hear anyones thoughts in this.

Thanks,

Peter


Viewing all articles
Browse latest Browse all 764

Trending Articles