NHibernate Session Management in Console App
I have core library of code which has multiple front ends. One front end is a WC开发者_如何学PythonF 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... ;)
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.
精彩评论