配置 NHibernate 以“随时随地”编译映射
默认情况下,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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(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)
您无法将映射添加到现有会话,只能实例化新会话。此处提出并回答了类似的问题:在运行时添加 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?