配置 NHibernate 以“随时随地”编译映射

发布于 2024-09-14 22:43:04 字数 167 浏览 2 评论 0原文

默认情况下,NHibernate 在创建 SessionFactory 时编译映射...

是否可以配置 NHibernate,以便它“随时随地”编译所需的映射?这样它只在需要时才编译映射?

我问的原因是为了解决启动时的冗长操作(winforms,嗯,AutoCAD 应用程序......)

By default, NHibernate compiles the mappings when creating the SessionFactory...

Is it possible to configure NHibernate so that it compiles the needed mappings "on the go"? So that it only compiles a mapping when it needs it?

The reason I'm asking is to work around the lenghty operation on start-up (of a winforms, well, AutoCAD application...)

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

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

发布评论

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

评论(2

不可能。加快会话工厂创建速度的一个好方法是 将配置对象序列化/反序列化到文件

Not possible. A good way to speed up session factory creation is serializing/deserializing the configuration object to a file.

Here are some more ideas to speed this up (or at least reduce the perceived startup time)

习ぎ惯性依靠 2024-09-21 22:43:04

您无法将映射添加到现有会话,只能实例化新会话。此处提出并回答了类似的问题:在运行时添加 nHibernate 映射?

You can't add mappings to an existing session, you can only instantiate a new Session. A similar question was asked and answered here: adding an nHibernate mapping at run time?

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