Re: Static Class Factory - Alice is seeing Bob's data
- From: rival@xxxxxxxxxxxxxxxxx <rivalnewsgroupsnospam@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 11 Oct 2007 05:29:03 -0700
Thanks for the replys - I've read the article Patrice recommended.
I understand that using static objects can have issues with shared values e.g.
static class TempStore
{
int myValue;
static TempStore()
{}
static Int GetValue()
{
return myValue;
}
static SetValue(int inpVal)
{
myValue = inpVal;
}
}
}
I can see that this would be bad as users will continuously be overwriting
each others values, but I don't see why this would be for a static class
factory
static class ClassFactory
{
static ClassFactory()
{}
static ProfileData GetProfile(Guid userID)
{
....Load DAL
....Get data
....Return data
}
}
Why would the GetProfile method above return the wrong data to the user?
Thanks
"Mark Rae [MVP]" wrote:
"rival@xxxxxxxxxxxxxxxxx" <rivalnewsgroupsnospam@xxxxxxxxxxxxxxxxxxxxxxxxx>.
wrote in message news:2CE233A8-8B05-4688-8A80-C251D505B528@xxxxxxxxxxxxxxxx
Have I royally messed up my architecture here?
Static variables in ASP.NET need *extremely* careful management because they
persist across all Sessions. That's almost certainly what you're seeing
here...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net
- Follow-Ups:
- Re: Static Class Factory - Alice is seeing Bob's data
- From: Patrice
- Re: Static Class Factory - Alice is seeing Bob's data
- From: bruce barker
- Re: Static Class Factory - Alice is seeing Bob's data
- References:
- Re: Static Class Factory - Alice is seeing Bob's data
- From: Mark Rae [MVP]
- Re: Static Class Factory - Alice is seeing Bob's data
- Prev by Date: Re: get text of pdf through syncfusion component
- Next by Date: Re: Cookies
- Previous by thread: Re: Static Class Factory - Alice is seeing Bob's data
- Next by thread: Re: Static Class Factory - Alice is seeing Bob's data
- Index(es):