4

I've just read this thread which discusses code to create an NHibernate SessionFactory object statically from a helper class:

Ensure NHibernate SessionFactory is only created once

What is the lifecyle of a static member variable in an ASP.NET application? Does it exist as long as the worker process? Or the ASP.NET session? Or something else?

I'm a little confused by it all to be honest.

Thanks

David

1 Answer 1

5

It exists as long as the worker process is alive. These usually recycle once per day (approximately) or if the site is inactive for 20 minutes.

They are unique to an appdomain, and a few more details about the use of static vs Application variables (which are your alternative in ASP.NET) can be found here.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.