POCO vs DTO: Is it ok to partially hydrate a domain object? -
A domain object is displayed in various ways on the UI; View and edit lists, search results, pages, as well as in header, footer and popup Typically you have many different "ideas" of domain objects, each different field is displayed.
When you need a subset or superset, most advice seems to be using DTO to get the data. There is too much overhead in maintaining the DTO. Is it a bad way to fill the properties of the required domain object for each scenario, for example, you can ask how to use properties like how to include properties such as:
< P> service.GetDomainObjects (int listID, Profile.ListProfile); Service.GetDomainObjects (String SearchParam, Profile. SearchProMail);
For me this comes down to what you want to be uppercase, or you want to represent your DTO There are going to be a set of different classes, or you are going to set up a set of methods that return each single domain object but are 'hydrated' in different areas. / P>
Some questions I would like to ask to help decide:
- What is the overhead in hydrating the whole object? Is the added complexity (DTO or partially hydrated objects) really meaningful?
- Is anyone else going to use your code? When people come to keep their code in order to keep their code, then DTO can be more clear.
I have a little personal preference for DTO because I think the long term maintenance of your system will be easy. If you have a male band, or it has thrown an app, then I will not fully understand how to present a bunch of additional code that will disrupt your code.
Comments
Post a Comment