Closed Chicagoan2016 closed 7 years ago
The way I did this in my last project was as follows:
The DTO for Unit of Work/ViewModel objects might have values from three different tables similar to what you have described. Admin DTO is a 1-1 mapping to my BusinessBase.
You can shape the DTO based on what works best for you. There are two primary approaches.
I'm a strong advocate for option 1, as I think it is far better for the DAL to manage that sort of abstraction, because that is its job. This allows the business object to focus entirely on business rules and not messy things like data source mapping.
Thank you Fuji, thank you Rocky, I will go ahead and generate DTOs that corresponds to my business classes but with simple properties.
Hi All, looking at the samples it appears we have a DTO for every table in the database? is this the recommended approach? What if we have a business objects that is using data fields from three different tables ( using stored proc for data access)? should we create a new DTO or use existing ones? perhaps an example will help :)
kind regards