Valid appraoch to State management?

G

Guest

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
 
K

Kevin Spencer

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
 
D

Dave Bush

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:[email protected]]
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
 
G

Guest

Dave, That is ***exactly** what I do too, I obviously did not make myself
clear!

Guy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,737
Latest member
Georgeengab

Latest Threads

Top