简体   繁体   English

NHibernate投影/ DTO对象是不可变的吗?

[英]Are NHibernate projection/DTO objects immutable?

如果我使用投影和导入映射创建DTo,则默认情况下该对象对于NHibernate是不可变的,还是可以在导入映射中定义mutable = false?

You could write a test that gets the same DTO from NHibernate then checks to see if they are reference equal. 您可以编写一个从NHibernate获取相同DTO的测试,然后检查它们是否相等。 If they are reference equal then I would assume NHibernate keeps them in the identity map. 如果它们参考相等,那么我将假设NHibernate将它们保留在身份图中。 My guess is that they are not reference equal. 我的猜测是,它们不是参考相等的。

ReferenceEquals(dto1, dto2)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM