Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best practice to persist Objects in Session Variables?
Message
De
18/11/2009 17:26:18
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Database:
Visual FoxPro
Divers
Thread ID:
01435454
Message ID:
01435469
Vues:
37
>No guru, but Just say no to session period.. :)
>
>You will save yourself a ton of head aches. If you never plan on having but a a few users (1-10) and you have a big box
>then maybe. Otherwise stay away from it.
>

In my experience, Session has not been a ton of head aches. Our business object is exposed via 4-15 pages and we have a requirement that it is saved in a single transaction. We persist a dataset in session (inproc) and have never had any issues. We typically average 60 concurrent users. We DO have a big box with a lot of RAM. :-)

That said, in the setting Matt describes, I would make the round trips to SQL Server. It is plenty fast.


>
>>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform