Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best practice to persist Objects in Session Variables?
Message
From
18/11/2009 16:22:00
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
Best practice to persist Objects in Session Variables?
Environment versions
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01435454
Message ID:
01435454
Views:
108
Ok all you gurus... I've got a question about using Session variables to store a few Business Objects once I've pulled in their Entity data from the back-end.

I use my Master Page to maintain several things that I want to be available for each page that is based on it, and I find it tempting to maintain those BO objects in Session variables so they will be easily available between page requests, right? I can just cast them back to their respective BO types, and I'm ready to go, without hitting the database again.

For instance, every page to which a user might navigate in my app use a Customer BO, an Invoice BO, a User BO, and a CurrentLineItem BO. (Each of these is a wwLinqToSql Business Object Wrapper BO from the West Wind Web Toolkit.)

So, is it cool to save each of those objects into Session variables once I get them all populated so I can easily re-create them on page re-generation.

An alternative would be to just store the Integer PK for each of those BO's in Session variables, and use that Integer key to re-fetch each BO, but that seems like a lot of unnecessary hits back to the database.

I don't have any understanding of the memory or bandwidth impact of storing a few Objects in session variables every time I send out a page to the user.

You have the entire Business Object, you have the Entity, and you have the Integer PK. Lots of possibilities, so I'm not sure which way to go.
Next
Reply
Map
View

Click here to load this message in the networking platform