Fluent NHibernate 与 Legacy 数据库复合问题

发布于 2024-10-15 10:04:08 字数 479 浏览 3 评论 0原文

我知道这些问题已经被问过很多次了,但有些问题已经持续了 6 个多月,而且产品也在不断发展。

我有一个数据库模式,由一些真正的专业人士新设计的,其结构很漂亮,位于 Enterprise Architect 中,准备生成为所需的任何数据库引擎类型。我还不想扔掉它。大约有3-4k张桌子。

我真的有很多问题。我从阅读堆栈和各种博客中了解到,使用 NHibernate 时,具有自动映射和约定的 Fluent NHibernate 是构建与遗留数据库良好集成的域层的最佳方法。我知道这是主观的,但这仍然是真的吗?

是否有任何示例或开源项目使用 FH 映射到现有数据库,以了解它如何大规模工作。

另外,在我离开之前,是否有人有使用商业工具集来实现此目的的经验?目前的技术状况如何?我已经查看了整个捆绑包,但许多文档都是针对新手的,如果排除 FH,很难确定什么是最佳选择。需要进行正式的产品测试、指标和报告来确定最佳选择,但经验很重要。

谢谢。 任何帮助将不胜感激。 鲍勃.

I know these questions been asked numerous times, but some of the questions are 6+ months, and products evolve.

I have a database schema, newly designed by some real pro's, beautiful in it's construction, sitting in Enterprise Architect, ready to be generated into any database engine type that's required. I don't want to dump it, just yet. Its around 3-4k tables.

I have a number of questions really. I undertstand from reading stack and various blogs that Fluent NHibernate with Automappings and Conventions is the best way, when using NHibernate, to construct a domain layer that integrates well with a legacy db. I know it is subjective, but is that still true?

Is there any example or open source projects that use FH to map to a existing database, to see how it works on the large scale.

Also before I go, does anybody have any experience of using a commercial toolset for this? What is the state of art at the moment. I've looked at a whole bundle but many of the docs are geared for greenfield, and it's hard to determine what would be the best choice if FH was ruled out. It would take a formal product testing, metrics and a report created to determine the best choice, but experience counts.

Thanks.
Any help would be appreciated.
Bob.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拒绝两难 2024-10-22 10:04:08

我针对旧数据库使用了本机 NHibernate 映射以及 FNH。恕我直言,当您可以使用 AutoMapping 功能时,FNH 的好处才真正体现出来。对于遗留数据库,假设在架构的构建中使用了可靠的约定,那么创建自定义 FluentNHibernate 约定类然后与 AutoMap 功能结合使用是一件相对简单的事情。不过,您不必使用 AutoMap,ClassMap(和/或 AutoMap 的覆盖)可以为您提供针对现有模式工作所需的所有灵活性。当然,这是主观的。有些人会认为 NHibernate XML 映射文件更适合遗留应用程序,因为您可以显式管理映射。每个人都有自己的。我两者都做过,并且看到了两者的优点/缺点。当选择 NHibernate 作为 O/RM 时,我更喜欢 FNH。

查看 SharpArchitecture 了解 FNH(以及其他 NHibernate 实践)的示例。我已经有一段时间没有获取它们的源代码了,但上次我浏览它时,它是 NHibernate 和 FNH 能力的一个很好的例子。

I've used native NHibernate mappings as well as FNH against legacy databases. The benefit of FNH, IMHO, is really expressed when you can use the AutoMapping features. For a legacy database, assuming there are solid conventions used in the construction of the schema, it's a relatively trivial thing to create custom FluentNHibernate Convention classes that then get used in conjunction with the AutoMap features. You don't have to AutoMap, though, and the ClassMap (and/or Overrides of the AutoMap) can give you all the flexibility you need to work against the existing schema. Of course, this is subjective. Some would argue that the NHibernate XML mapping files are better against legacy apps as you're explicitly managing the mappings. To each his own. I've done both, and have seen pros/cons of both. I prefer FNH when NHibernate is the chosen O/RM.

Check out SharpArchitecture for examples of FNH (and other NHibernate practices). It's been awhile since I've pulled their source, but the last time I wandered through it, it was a good example of what NHibernate and FNH are capable of.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文