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 7 1223
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" <no****@pokercat.co.ukwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
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
yes .net sorry.
I am more wanting to know how it will handle a singleton implementation not
how to implement one, tho i cant see an singleton implementation on that
blog? Is it very different to a standard one on .net?
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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" <no****@pokercat.co.ukwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
>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
If you have static values it is one instance for *all* users. If you want
one instance for *each* user then you could store your object in the
Session.
"PokerMan" <no****@pokercat.co.ukwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
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
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" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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" <no****@pokercat.co.ukwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
>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
Did you look at entry at the correct date?
private WebSessionDataStore() //constructor
{
this.m_itemCollection = new HybridDictionary();
}
/// <summary>
/// Singleton representing WebSessionDataStore.
/// </summary>
/// <returns></returns>
public static WebSessionDataStore GetInstance()
{
//other stuff here
}
Singleton is a DESIGN PATTERN, not "just an asp.net thing". http://www.dofactory.com/Patterns/PatternSingleton.aspx
static/shared variables are another thing.
Based on your description of what you want
if the singleton would work as one isntance per user or one instance for
allusers (not what i want)
I've shown you how to create a true SINGLETON for the web environment.
You can find more by googling also: http://www.google.com/search?hl=en&q...+%22asp.net%22
"PokerMan" <no****@pokercat.co.ukwrote in message
news:e2**************@TK2MSFTNGP02.phx.gbl...
yes .net sorry.
I am more wanting to know how it will handle a singleton implementation
not
how to implement one, tho i cant see an singleton implementation on that
blog? Is it very different to a standard one on .net?
"sloan" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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" <no****@pokercat.co.ukwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
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
My singleton example piggybacks off of SESSION, therefore you will get "one
per user".
I use a method ... because I think thats what GOF (gang of four) does. http://www.dofactory.com/Patterns/PatternSingleton.aspx
uses a method also.
.....
Again, because I piggy back off of Session, its "one per user".
If I were to piggyback off of Application (object, instead of Session)
(which I actually do in another scenario)....
it would be "all users".
"PokerMan" <no****@pokercat.co.ukwrote in message
news:eS**************@TK2MSFTNGP04.phx.gbl...
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" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
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" <no****@pokercat.co.ukwrote in message
news:uk**************@TK2MSFTNGP04.phx.gbl...
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
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" <sl***@ipass.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>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" <no****@pokercat.co.ukwrote in message news:uk**************@TK2MSFTNGP04.phx.gbl...
>>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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: stephan beal |
last post by:
Good morning, C++ users,
i've been hesitating to post this, primarily because i know that most of you
here are *way* ahead of me in C++ and i'm a little embarassed about the
possibility of some...
|
by: Tito |
last post by:
I have two questions about the singletons' chapter of Alexei Alexandrescu's
"C++ Modern Design".
1. In the beginning of the chapter Alexei states that a "singleton" class
implementation made of...
|
by: Dominik Rau |
last post by:
Hi.
I've got the following problem here: In my application, I use a lot of
Singletons, that are implemented as described in Gamma et al. (shortened):
//.h
class Singleton{
public:
static...
|
by: 6tc1 |
last post by:
Hi all, I'm having a problem where in my solution that contains
multiple projects - I instantiate a singleton class in one assembly and
then if another assembly tries to use that singleton class...
|
by: John Fly |
last post by:
I'm working on a large project(from scratch). The program is
essentially a data file processor, the overall view is this:
A data file is read in, validated and stored in a memory structure...
|
by: Steven Watanabe |
last post by:
PEP 8 says, "Comparisons to singletons like None should always be done
with 'is' or 'is not', never the equality operators." I know that "is"
is an identity operator, "==" and "!=" are the equality...
|
by: Omega |
last post by:
I'm interested in seeing a bit of discussion about using singletons in
ASP.NET 2.0.
Currently I've designed a singleton that gets a reference to it's
single instance stored inside the ASP.NET...
|
by: =?Utf-8?B?R29yZG8=?= |
last post by:
Hello everyone,
I've been trying for some time now to move to C++/CLI, but I have several
large legacy C++ static libraries I need to use. When I set up a simple
solution with a C++/CLI Winforms...
|
by: adam.timberlake |
last post by:
I was reading an article on TalkPHP (http://www.talkphp.com/
showthread.php?t=1304) about singletons but I'm afraid I don't
understand why I need to use them. I understand how to code them...
|
by: Craig Allen |
last post by:
Hey, forgive me for just diving in, but I have a question I was
thinking of asking on another list but it really is a general question
so let me ask it here. It's about how to approach making...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |