Skip to content

GenericServices and DTOs

Jon P Smith edited this page Apr 10, 2018 · 17 revisions

GenericServices makes heavy use of DTOs (Data Transfer Objects, also known as ViewModels). Let me give you an example of why you would want to use a DTO, and then I can describe how to set them up for GenericServices to use.

The problem that DTOs solve

I my example application I can add a price promotion to a book. Here is the screen that an admin person is using to add a new promotion to the book "J2EE FrontEnd Technologies". The words in red have been input by the admin person.

Add promotion screen

This form contains a subset of all the properties in the book, and in some cases could contain information from other entities. For instance I might have shown the author(s) of the book.

Typically this sort of selected