static vs appsession

  • Thread starter Thread starter rodchar
  • Start date Start date
R

rodchar

hey all,

if i wanted to instantiate my business class just once is there a difference
between making a static variable out of it and putting it in say application
session?

thanks,
rodchar
 
rodchar laid this down on his screen :
hey all,

if i wanted to instantiate my business class just once is there a difference
between making a static variable out of it and putting it in say application
session?

thanks,
rodchar

Yes, a very big difference:
A static variable would be shared by all users of your site.
A Session variable would be visible to a single session only (and other
sessions would have other instances of it)

Hans Kesting
 
hey all,

if i wanted to instantiate my business class just once is there a
difference between making a static variable out of it and putting it
in say application session?

thanks,
rodchar

Session or Application?

The difference here is Session is per user, Application is for all
users.

A static class is essentially the same for both, unless you share a
single process for multiple apps, in which case it is possible to have
an object across multiple sites with a static class. Otherwise, they are
functionally the same.

The perf over static versus storing in application is similar. You might
end up with a small amount of overhead with a Application object, but
you can still use static methods, properties, etc when storing in
application.

If you mean the Session object, static will not work.

Peace and Grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
rodchar laid this down on his screen :

Yes, a very big difference:
A static variable would be shared by all users of your site.
A Session variable would be visible to a single session only (and
other sessions would have other instances of it)

Hans Kesting

I think the OP means the Application object, not Session object.

peace and grace,

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

*******************************************
| Think outside the box! |
*******************************************
 
Back
Top