FluentNHibernate 或通过代码映射到 NHibernate 的端口
我有几个项目使用 NH 和 FNH 来生成映射(一些 Fluent 一些 Automapped)。仍然存在一些我需要的错误和缺失的功能,但似乎 FNH 可能会因为集成到 NHibernate 中的代码映射而消亡。
问题:为 FNH 做出贡献,或者将映射迁移到代码映射或 confORM 并在那里解决问题/实现功能?
I have several projects using NH and FNH to generate the mappings (some Fluent some Automapped). There are still some bugs and missing features i need, but it seems that FNH could die because of mapping-by-code integrated into NHibernate.
Question: Contribute to FNH or to migrate the mappings to mapping-by-code or confORM and fixing problems/implementing features there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我们的办公室,我们已经使用 NHibernate 3 年了。我们一直在考虑迁移到 Fluent Nhibernate,但从未付诸行动。使用 hbm.xml 文件仍然是最容易调试/更改的。这些 xml 文件的两个常见问题是它们都是在创建 sessionfactory 期间进行验证的,并且它们不是重构安全的。
由于一个错误,我不得不更新 NHibernate 的较新版本(我们使用的是 NHib 2.1.2GA),当我实现 3.2GA 时,我们还获得了使用 loquacious 映射(通过代码映射)的能力。我决定使用 Loquacious 而不是 Fluent,因为我不依赖于另一个项目 (Fluent),而且如果代码映射被破坏,NHibernate 将不会被发布。
但请注意,Loquacious 映射也不完整。当我通过代码映射所有内容时,我发现像 property-ref 这样的基本内容并不总是被实现。因此,即使已发货,也不是 100% 完成的。虽然这不会令人震惊,但它存在错误。是的。真的。 ;-)
有关(报告的)错误的更多信息,请查看 NHibernate 错误数据库:https://nhibernate。 jira.com/browse/NH
希望这有帮助。
问候,特德
At our office, we have been using NHibernate for 3 years now. We've been thinking about making a move to Fluent Nhibernate but never made the move. Using hbm.xml files was still the easiest to debug/alter. Two common problems of those xml files are that they are all validated during the creating of the sessionfactory and they are not refactor-safe.
Due to a bug I had to update a newer release of NHibernate (we were using NHib 2.1.2GA) and when I implemented 3.2GA we also were handed the ability to use loquacious mappings (mapping by code). I decided to use Loquacious over Fluent because I don't have a dependency to another project (Fluent) and the fact that NHibernate won't be shipped if mapping by code is broken.
Be aware though, that Loquacious mapping isn't complete either. While I was mapping everything by code, I found out basic stuff like property-ref wasn't always implemented. Thus even though it's shipped, it's not 100% complete. And while this will not come as a shocker, it has bugs. yes. really. ;-)
for more info on (reported) bugs, check out the NHibernate bug database: https://nhibernate.jira.com/browse/NH
Hope this helps.
Regards, Ted
感谢@TedOnTheNet,我将继续使用 FNH 并为 FNH 做出贡献,因为在某些领域,代码映射达到 FNH 需要一段时间,
< code>.Database(SQLiteConfiguration.Standard.InMemory()) 仍然比
更容易弄清楚
.Database(SQLiteConfiguration.Standard.InMemory())
仍然比某些功能默认值<强>更新: hbm.xml(和 FluentMapping)中的某些功能根本无法通过代码进行映射:
thx to @TedOnTheNet i will continue to use and contribute to FNH, because it will take a while until mapping-by-code reaches FNH in some areas
.Database(SQLiteConfiguration.Standard.InMemory())
is still easier to figure out thanand some features:
Update: some features from hbm.xml (and FluentMapping) will not be possible at all with mapping by code:
据我所知,NH 3.2 没有任何与 FNH 的 Automapping 相当的功能。 (对我来说,这将是一个破坏性的事情)。
编辑
FNH Automapper 可以处理对象模型中的大多数常见模式,例如继承、一对多关系、自引用等 - 无需程序员的任何帮助。到目前为止,纯NH还没有达到这种自动化水平。
此外,James Gregory 还公开表示,他将继续开发 FNH,至少在短期内是这样。 (我几个月前在 FNH Google 群组上看到过这个,但我不确定具体在哪里)。
NH 3.2 does not have anything remotely equivalent to FNH's Automapping, as far as I can tell. (For me, that would be a dealbreaker).
Edit
The FNH Automapper can deal with most of the common patterns in an object model, such as inheritance, one-to-many relationships, self-referencing, etc - without requiring any help from the programmer. So far, pure NH has not achieved this level of automation.
Also, James Gregory has publicly stated that he will continue to develop FNH, at least in the near term. (Think I saw this on the FNH Google group a few months back, but I'm not sure exactly where).