为什么 JHipster 不为每个域生成一个 DTO 对象?
Why does JHipster not generating a DTO object for each domain?
我有点好奇。
为什么 JHipster 不为每个领域对象生成 DTO 对象并将领域对象直接发送到 UI 层?
-talx
DTO 生成是基于每个实体配置的,在您的实体 JSON 中使用 "dto": "mapstruct"
选项。
有关如何使用 DTO 的指南以及为什么默认情况下没有为每个实体启用它们的解释,请在此处查看官方文档:http://jhipster.github.io/using-dtos/
可以在 entities.jdl
文件中通过添加
启用 DTO 生成
dto * with mapstruct
service * with serviceClass
然后用jhipster import-jdl ./entities.jdl
生成代码
有关详细信息,请参阅此处 https://www.jhipster.tech/jdl/#optiondeclaration
我有点好奇。
为什么 JHipster 不为每个领域对象生成 DTO 对象并将领域对象直接发送到 UI 层?
-talx
DTO 生成是基于每个实体配置的,在您的实体 JSON 中使用 "dto": "mapstruct"
选项。
有关如何使用 DTO 的指南以及为什么默认情况下没有为每个实体启用它们的解释,请在此处查看官方文档:http://jhipster.github.io/using-dtos/
可以在 entities.jdl
文件中通过添加
dto * with mapstruct
service * with serviceClass
然后用jhipster import-jdl ./entities.jdl
有关详细信息,请参阅此处 https://www.jhipster.tech/jdl/#optiondeclaration