控制台应用程序中的 NHibernate 会话管理

发布于 2024-08-11 11:03:27 字数 220 浏览 3 评论 0原文

我有具有多个前端的核心代码库。一个前端是 WCF 服务,另一个是控制台应用程序,它仅启动一些长时间运行的命令,这些命令执行财务计算和其他业务逻辑。我试图弄清楚如何在控制台应用程序中管理我的 ISession。我“可以”每个“命令”只有一个会话,但有些命令是长时间运行的过程,我担心会话打开那么长时间和/或它变得太臃肿。对于这种类型的场景有什么指示吗?

在 Web 应用程序中管理 NH 会话要容易得多...;)

I have core library of code which has multiple front ends. One front end is a WCF service, another is a console app that just launches some long running commands which perform financial calcs and other business logic. I am trying to figure out how to manage my ISession in the console app. I 'could' just have one session per "command", but some of the commands are long running process and I am worried about having a session open for that long and/or it getting too bloated. Any pointers for this type of scenario?

Managing the NH session in a web app is so much easier... ;)

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

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

发布评论

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

评论(1

有木有妳兜一样 2024-08-18 11:03:27

您可以定期(例如每 5-30 秒一次,具体取决于执行的插入/更新/删除量)或在关键时刷新 ISession。我最近使用 Spring .Net 框架中的 AOP 功能来执行某些方法,该过程可能需要 30 分钟才能完成。

You could either have the ISession flush periodically (say every 5-30 seconds, depending on the amount of inserts/updates/deletes being performed) or when it is critical. I recently used AOP functionality in the Spring .Net framework to execute after certain methods were executed in a process that would take perhaps 30 minutes to complete.

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