Re: Singletons in asp

Tech-Archive recommends: Fix windows errors by optimizing your registry



it can be coded either way, depends on how you code it.

-- bruce (sqlwork.com)

PokerMan wrote:
Ah found ur singletom implementation on the blog, my apologies. And its similar to mine, not sure why you use a method and dont set the instance as a property get{} but its the same in essence.

So in answer to my original question a singleton will work as i expect? Single instance per user, not one instance effected by all users?



"sloan" <sloan@xxxxxxxxx> wrote in message news:%23GxTXJjaHHA.1216@xxxxxxxxxxxxxxxxxxxxxxx
First, I'll assume you're speaking of asp.net and not just asp.

They are different things.

Here is an example of a asp.net singleton:

10/24/2005
Web Session Wrapper for storing and retrieving objects
http://sholliday.spaces.live.com/blog/


PS
You should mark
public class WebSessionDataStore

as [Serializable]

and make any objects you put in there serializable if you go to sql server
session state management.



"PokerMan" <nospam@xxxxxxxxxxxxxx> wrote in message
news:ukskBEjaHHA.4788@xxxxxxxxxxxxxxxxxxxxxxx
Hey guys

Just a quick question. If i had a static var, then all users coming onto
my
site will be sharing the same var. So if i have a class that is a
singleton
would the same happen there?

Basically i have a class that will only ever have one instance so,
singleton
makes sense. But due to asp and lots of connecting users it had me
wondering
if the singleton would work as one isntance per user or one instance for
all
users (not what i want)

Thanks





.


Quantcast