我们将使用DTO来在演示层与后端之间传递数据。
我有一个服务对象上的方法叫做
我想了解一下在DTO架构方面哪种方案更好:
我有一个服务对象上的方法叫做
PostAd
,它可以发布用户输入的广告。这个Ad
对象与另一个叫做AdValues
的对象相关联,它包含了Ad
的各种值(如标题、价格、描述等)。@Entity
public class Ad {
@OneToMany
Set<AdValue> values ...
...
我想了解一下在DTO架构方面哪种方案更好:
have two DTO's one called
AdDTO
and the other calledAdValuesDTO
and call thePostAd
method asPostAd(AdDTO, AdValuesDTO)
~or~Have an
AdDTO
that contains theAdValuesDTO
mimicking the entity structure... this involves having DTO's within DTO's:AdDTO { Set<AdValuesDTO> adValues ...
那么PostAd
方法被称为PostAd(AdDTO)
还有其他的替代方案吗?