控制台应用程序中的 NHibernate 会话管理
我有具有多个前端的核心代码库。一个前端是 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以定期(例如每 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.