良好的身份映射实现?
nhibernate 是否使用通用哈希和等式生成器(从主键定义派生)作为其身份映射?我想这是一种方法。我想知道 nhibernate 是如何实现这一目标的。
何苦呢?我被要求使用一个可以使用nhibernate的数据库,但现在社区不支持它(这是过去的事)。只是想破解我前进的道路。我可能会稍后再回到这个问题并编写 nhibernate 层/插件,但这有点矫枉过正,而且有点超出了我目前的资源范围。
发布问题后,我在下面找到了这些参考文献 [1]。如果能找到一本介绍不同边缘情况的书或一篇网络文章,那就太好了。
参考[1]:
Does nhibernate use a generic hash and equality generator (derived from primary key definitions) for its identity map? That's one way of doing it I guess. I was wondering how nhibernate went about achieving this.
Why bother? I was asked to use a database that could use nhibernate, but it is not supported by the community right now (it was in the past). Just want to hack my way forward. I may come back to this later and write that nhibernate layer / plugin, but that's overkill and a little bit beyond my resources at this time.
After posting the question I found these refences below [1]. It'd be nice to find a book or a web post that went through the different edge cases.
reference [1]:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看
以获得良好的身份映射实现。
如果我理解正确的话,你想编写自己的类似 ORM 的层,因为 NHibernate 不支持你想要的数据库。这可能是一项艰巨的任务。您可能希望通过提供自己的驱动程序和方言来扩展 NHibernate。
Java Persistence with Hibernate 中已经有一个非常好的描述: 9.2 对象同一性和平等性。在 NHibernate 在线文档中:4.3。实现 Equals() 和 GetHashCode()。
Take a look at
in Nhibernate sources for a good identity map implementation.
If I understood you correctly you wanted to write your own ORM-like layer because NHibernate does not support the database you want. It can be a daunting task. You might want to look at extending NHibernate by providing your own Driver and Dialect.
There is already a a very good description in Java Persistence with Hibernate: 9.2 Object identity and equality. And in online NHibernate docs: 4.3. Implementing Equals() and GetHashCode().