本文介绍了什么是NHibernate中的Tuplizer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在NHibernate中看到一篇提到Tuplizer的帖子,有人能为Tuplizer提供一个很好的定义或参考吗?

I came across a post that mentioned Tuplizer in NHibernate, can anybody provide a good definition or reference for Tuplizer?

推荐答案

来自 ITuplizer的源代码:

如果认为给定的数据 作为数据结构,然后 翻板机是知道的东西 到:

If that given piece of data is thought of as a data structure, then a tuplizer is the thing which knows how to:

  • 创建这样的数据结构 适当地
  • 从中提取值 并将值注入此类数据 结构
  • create such a data structure appropriately
  • extract values from and inject values into such a data structure

例如,给定的数据 可以表示为POCO类. 在这里,它是代表 实体模式为POCO.好一个tuplizer POCO实体模式会知道 到:

For example, a given piece of data might be represented as a POCO class. Here, it's representation and entity-mode is POCO. Well a tuplizer for POCO entity-modes would know how to:

  • 通过创建数据结构 调用POCO的构造函数
  • 通过以下方式提取和注入值 吸气剂/设定者,或按直接领域 访问等
  • create the data structure by calling the POCO's constructor
  • extract and inject values through getters/setter, or by direct field access, etc

同一条数据 也可能表示为DOM 结构,使用tuplizer 与XML实体模式相关联, 这将生成 XmlElement作为数据结构和 知道如何以下列方式访问值 嵌套的XmlElements或as XmlAttributes.

That same piece of data might also be represented as a DOM structure, using the tuplizer associated with the XML entity-mode, which would generate instances of XmlElement as the data structure and know how to access the values as either nested XmlElements or as XmlAttributes.

法比奥·毛洛(Fabio Maulo):

使用自定义修整器可以做一些事情:

Some things you can do with custom tuplizers:

  • Remote lazy loading (the article uses Java Hibernate but the general concepts apply to NHibernate as well)
  • Seamlessly mapping/persisting interfaces instead of POCOs
  • Mapping/persisting F# records (from the FunctionalNHibernate project)

这篇关于什么是NHibernate中的Tuplizer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 19:52