473,325 Members | 2,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

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
Nov 1 '07 #1
4 1207
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" <gu*@discussions.microsoft.comwrote in message
news:20**********************************@microsof t.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

Nov 1 '07 #2
As Kevin indicated, the Session State mechanism already is "a box" to put
things in by key name. Also, storing smaller, simpler objects in Session is
faster. So the concept of having your own object that may hold various other
objects could cause a serialiazation/deserialization performance hit.
-- Peter
// Abandon all hope, ye who enter here.
http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"guy" wrote:
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
Nov 1 '07 #3
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/WebD...8/Default.aspx

-----Original Message-----
From: guy [mailto:gu*@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

Nov 1 '07 #4
Dave, That is ***exactly** what I do too, I obviously did not make myself
clear!

Guy

"Dave Bush" wrote:
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/WebD...8/Default.aspx

-----Original Message-----
From: guy [mailto:gu*@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

Nov 1 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Zeya | last post by:
I have this code, which uses WMI to operate on Windows service from C# code. When Service.InvokeMethod is called, the method throws an exception: System.Management Operation is not valid due...
4
by: Chad Crowder | last post by:
I've taken a look at this article http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspnet/html/asp12282000.asp which someone posted a month or so ago regarding setting up SQL...
2
by: John A Grandy | last post by:
for high traffic public websites , what are the proven options for session-state storage & management ? is an out-of-process state-server generally preferred over a sql-server ? what are the...
1
by: John Grandy | last post by:
Could someone point me in the direction of good discussions on scalable state management solutions? Specifically, pros and cons of following strategies: Strategy 1 : temporary business-objects...
2
by: geodev | last post by:
Hello, I’m currently writing an asp.net application that will be running on a Windows XP Professional workstation utilising IIS and MSDE Database. At a later date this application will need to...
13
by: James Hunter Ross | last post by:
We love the ASP.NET "Session" concept and make good use of it. But, getting close to deployment we find we lose sessions far too often, probably due to application restarts, etc. We hope to...
3
by: cmay | last post by:
The question is: Which one of the following is NOT a valid state management tool? And the possible answers are: 1. Hidden Form Fields 2. Cookies
5
by: knyghtfyre | last post by:
Hello, My company is developing a rather large application with .NET 2.0. We are expanding to a server farm and are in the process of converting our application to use an out-of-process session...
0
by: kirk | last post by:
I have three events that I have created and manage with timers. Two of the timer event handlers, the last two in the code below, need to reset state management data, if the first event handler...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.