We will fetch our customer model from the database as source and we will convert source customer model to target Customer DTO data structure which is subset of the customer model and will be passed customer DTO to UI. ![]() For example, we have customer table(CustomerModel) in the database with 30 fields but we required only 10 field of them to return to Front end(UI) or other API. In applications, we need to create a subset of data from a larger data structure. ![]() It means that Converters create new instances of Data objects and call Populators to populate these data objects. Using Converters, we will trying to create a target DTO by converting a source Model object and using Populators to populate the DTO. Data Transfer Objects (DTOs) are objects created to only contain values and have no business logic except for getter and setter methods DTOs help to further decouple presentation from the service layer and the domain model. ![]() A DTO is helpful whenever you need to group values in ad hoc structures for passing data around. In the field of programming, we can describe DTO like " It is a object that used to encapsulate data, and transfer the data between classes and modules of your application ". Before start to converters and populators, We need to understand DTO (Data transfer object).
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |