NHibernate + WCF + Windows Service 和 WcfOperationSessionContext 类 [英] NHibernate + WCF + Windows Service and WcfOperationSessionContext class
本文介绍了NHibernate + WCF + Windows Service 和 WcfOperationSessionContext 类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- 我有一个 Windows 服务应用程序我在其中创建 WCF 服务.
- 其中一项服务是数据服务:添加、删除、通过读取、更新数据WCF.
- WCF 使用 NHibernate 进行数据操作
所以我的客人是:
对于使用 WCF 的 Hibernate 会话管理有什么建议(最佳实践)?
任何人都知道
WcfOperationSessionContext(休眠 3.0)类?
how to use it with WCF?
好吧,让它具体:
假设我有一个名为 DataServices
class WCFDataService .....
{
void SaveMyEntity(MyEntity entity)
{
.....................?? // How to do? Best Way
// Should i take one session and use it all times
// Should i take session and dipsose when operation finished then get
//new session for new operations?
// If many clients call my WCF service function at the same time?
// what may go wrong?
// etc....
}
}
我需要一个 NHibernateServiceProvider 类
class NHibernateServiceProvider ....
{
// How to get Session ?? Best way
ISession GetCurrentSession(){.... }
DisposeSession(){ ....}
}
最美好的祝愿
PS:我在这里和其他网页上阅读过类似的条目.但是看不到具体"的答案.
PS: I have read similiar entries here and other web pages. But can not see "concrete" answers.
推荐答案
这里有一个 post 详细描述了注册和使用 WcfOperationSessionContext 的所有步骤.它还包括在 agatha-rrsl 项目中使用它的说明.
Here is a post describing, in detail, all the steps for registering and using the WcfOperationSessionContext. It also includes instructions for using it with the agatha-rrsl project.
这篇关于NHibernate + WCF + Windows Service 和 WcfOperationSessionContext 类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文