views:

242

answers:

1

Hi, Can any one tell me which one is better in "Session Facade Class" and "Singleton Object" design patterns in ASP.Net? Also, please state the scenarions where specific design pattern is advisable to use.

Thanks Rupa

A: 

The big differences will be in the lifetime and isolation of the objects. A facade over Session data will still have data that is only accessible by a single user's Session and will die once the Session is torn down. Singletons will last for the lifetime of the application and be accessible across all Sessions.

Singleton's can get you into threading problems if you are not very careful and thus, you should prefer Session data over a Singleton unless you have compelling reasons to do otherwise.

Thomas