【发布时间】:2012-11-23 08:33:12
【问题描述】:
- 是否可以为 DTO 对象创建映射然后查询它们 而不是域?如果不解释为什么?
- 如果我需要几个 dto 怎么办?
- DTos 是只读的
- ID 由 NH 自动生成
- 将来这些 dto 将设置映射到链接的 dto。
-
我使用 DTO 来减小查询大小
<class name="Person" table="`APP_Person`"> <property name="FirstName" type="string" length="512" /> <property name="Age" type="int" /> <property name="SocialNumber" type="int" /> <property name="PassportId" type="int" /> <property name="Salary" type="int" /> </class> <class name="PersonDTO" table="`APP_Person`"> <property name="FirstName" type="string" length="512" /> <property name="Age" type="int" /> </class>
【问题讨论】:
-
不少问题 1) 这些是只读的 DTO 和 2) 你会尝试在这里映射集合或多对一吗? 3)你的身份策略在哪里?这是为了优化返回的数据吗?
标签: nhibernate mapping