NHibernate + ASP.NET + Open Session in View + L2Ca

2020-07-22 03:27发布

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

2条回答
时光不老,我们不散
2楼-- · 2020-07-22 04:12

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.

查看更多
混吃等死
3楼-- · 2020-07-22 04:25

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

查看更多
登录 后发表回答