NHibernate Win Forms会话管理 [英] NHibernate Win Forms Session Management

查看:118
本文介绍了NHibernate Win Forms会话管理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前在Web应用程序中使用过NHibernate。我必须承认,我还在学习NHibernate,并没有完全掌握会话管理的艺术。所以我想在我写的Win Forms应用程序中使用NHibernate。我听说一个表单应用程序中的会话管理有点不同。会话必须在谈话的基础上开放和关闭。是?有人知道这个很好的例子吗?或者也许有一些粘性的文档解释了一个win32应用程序中的会话创建和拆除?



谢谢,



/ p>

解决方案

已经有一种在WinForms应用程序中管理NHibernate会话的模式,称为每个商业交易的对话。可以在这里找到一个很好的描述:



http://fabiomaulo.blogspot.com/2008/12/conversation-per-business-transaction.html
http://fabiomaulo.blogspot.com/2009/01/using-conversation-per-business.html



基本上它使用对话抽象:它可以开始,暂停,恢复,结束。每个操作都执行自动会话和事务管理。我非常推荐它,绝对值得一看。


I have used NHibernate in web applications before. I must admit that I am still learning NHibernate and do not totally grasp the art of session management. So I would like to use NHibernate within a Win Forms application that I am writing. I hear that session management in a Forms application is a bit different. Sessions must be opened and closed on a conversation basis. Yes? Does anyone know of a good example of this? Or perhaps some cohesive documentation explaining session creation and tear down within a win32 app?

Thanks,

Nick

解决方案

There is already a pattern established for managing NHibernate sessions in WinForms applications called Conversation per business transaction. A good description can be found here:

http://fabiomaulo.blogspot.com/2008/12/conversation-per-business-transaction.html http://fabiomaulo.blogspot.com/2009/01/using-conversation-per-business.html

Basically it uses a conversation abstraction: it can start, pause, resume, end. Each operation does automatic session and transaction management. I highly recommend it, definitely worth taking a look.

这篇关于NHibernate Win Forms会话管理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆