Volume of static objects in ASP.NET

I just read this thread, which discusses the code for creating an NHibernate SessionFactory object statically from a helper class:

Ensure that NHibernate SessionFactory is Created Only Once

What is the life cycle of a static member variable in an ASP.NET application? Does this exist until the workflow? Or an ASP.NET session? Or something else?

I'm a little confused by all of this, to be honest.

thanks

David

+4
source share
1 answer

It exists while the workflow is alive. They are usually processed once a day (approximately) or if the site is inactive for 20 minutes.

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

+5
source

Source: https://habr.com/ru/post/1314715/


All Articles