These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: ASP.NET, Application Domains and ISessionFactory
PostPosted: Sat Dec 09, 2006 10:08 am 
Newbie

Joined: Sat Dec 09, 2006 10:01 am
Posts: 1
Hi!

I may have misunderstood some of the guidelines on ASP.NET and session handling that is presented on the NHibernate website. Nevertheless, I dare to ask my question.

The HTTP-modules I have seen implemented, that does session handling in ASP.NET, I think they store session factories in the HttpContext.Application collection. I am just wondering, is anything wrong with storing a single session factory per application domain, i.e. in a static variable/property? I know this is not a viable approach for session objects, but does it also apply to session factories?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 10, 2006 2:20 am 
Senior
Senior

Joined: Mon Aug 21, 2006 9:18 am
Posts: 179
The session factory is an expensive process to create so typically there would only be one session factory per app domain. In the HttpModules you have seen you should see a check first for whether the factory has been initialized (from the configuration) and if so to NOT do so again.
So calls like this
Code:
Configuration cfg = GetConfiguration();
sessionFactory = cfg.BuildSessionFactory();

should only be done upon the Application startup.

Hope this helps
MIKE

_________________
If this helped...please remember to rate it!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.