Re: Valid appraoch to State management?
by Kevin Spencer on 11/1/2007 3:19:00 AM
The Session object already does this. In essence, as an analogy, you are
suggesting that you create a box to put everything in, and put it in the box
to put everything in, unless I'm misunderstanding your intention.
--
HTH,
Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
"guy" <guy@discussions.microsoft.com> wrote in message
news:20802762-FAC4-49DA-A6FE-B8BD9A02C465@microsoft.com...
> Is this a valid approach to State Management?
>
> What I do is define a class 'State' which holds all the objects etc. that
> I
> need to store in the Session.
> I can then get my state object and reference all the objects that I need .
> Later I can then save my state object back for use later.
>
> This makes coding much simpler than storing individual items in the
> session
> state but is there a performance hit for working this way?
>
> guy
Re: Valid appraoch to State management?
by Dave Bush on 11/1/2007 3:40:00 AM
As has already been mentioned, depending on the size, yes, you'll see a
performance hit.
However, you can do this with smaller objects marked as serializable OR
wrap the individual session variables with a class, which is my
preference. This way, I end up working with typed session variables, I
don't have to remember what string I used for the key, and I get
intellisense on my session vars.
http://www.dmbcllc.com/Articles/WebDevelopment/TypeSafeSessionVariables/tabid/168/Default.aspx
-----Original Message-----
From: guy [mailto:guy@discussions.microsoft.com]
Posted At: Thursday, November 01, 2007 7:08 AM
Posted To: microsoft.public.dotnet.framework.aspnet
Conversation: Valid appraoch to State management?
Subject: Valid appraoch to State management?
Is this a valid approach to State Management?
What I do is define a class 'State' which holds all the objects etc. that
I
need to store in the Session.
I can then get my state object and reference all the objects that I need .
Later I can then save my state object back for use later.
This makes coding much simpler than storing individual items in the
session
state but is there a performance hit for working this way?
guy