NHibernate + ASP.NET +在视图中打开会话 +二级缓存
我正在使用 CodeProject 著名的 Open Session in View
来处理 NHibernate 会话。它与二级缓存
配合得很好吗?有人成功做过吗?我应该使用 NH.Burrow
来代替吗?任何有关 ASP.NET 最佳实践中的二级缓存的建议都值得赞赏。
编辑:链接到 CodeProject 的文章: http://www.codeproject.com/KB/architecture /NHibernateBestPractices.aspx
I am using CodeProject's well known Open Session in View
to handle NHibernate Sessions. Does it works well with Level 2 Cache
? Anyone has succeeded doing it? Should I use NH.Burrow
instead? Any advice on l2 cache in asp.net best practices is appreciated.
Edit: link to CodeProject's article: http://www.codeproject.com/KB/architecture/NHibernateBestPractices.aspx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用工作单元模式来处理我的会话。然后我创建了一个 HttpModule,它实现了“每个 Web 请求的会话”生命周期,效果非常好。我的 HttpModule 在 PreExecuteRequestHandler 挂钩上启动一个工作单元,然后将其存储在请求中。然后它使用 PostExecuteRequestHandler 挂钩来完成工作单元。
这是我的工作单元所基于的文章:
http://nhforge.org/wikis/patternsandpractices /nhibernate-and-the-unit-of-work-pattern.aspx
I use the Unit of Work pattern to handle my session. Then I create an HttpModule that implements a "Session Per Web Request" lifetime that works really well. My HttpModule starts a Unit of Work on the PreExecuteRequestHandler hook, then stores it in the request. Then it uses the PostExecuteRequestHandler hook to complete the Unit Of Work.
This is the article my Unit of Work is based on:
http://nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx
至于 NHibernate L2 缓存,请查看这篇文章,
NCache 作为 L2 缓存。
NCache 是.NET 和Java 的企业级分布式缓存,还为ASP.NET 和JSP 会话提供快速可靠的存储。 NCache 还提供用于 Nhibernate 二级缓存的插件。
AS Far as NHibernate L2 cache is concerned, please check this read,
NCache as L2 cache.
NCache is an enterprise level distributed cache for .NET and Java and also provides a fast and reliable storage for ASP.NET and JSP Sessions. NCache also offers its plug-in for Nhibernate secondary level caching.