Print Page | Close Window

ASP.NET Session "Persistence Manager"

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=2075
Printed Date: 23-Apr-2025 at 10:13am


Topic: ASP.NET Session "Persistence Manager"
Posted By: Murray
Subject: ASP.NET Session "Persistence Manager"
Date Posted: 18-Aug-2010 at 9:46pm
 In an ASP.NET app, what is the difference between

'from global.asx
Session("PersistenceManager") = New PersistenceManager(True)
 
and
 
Dim pm As PersistenceManager = PersistenceManager.DefaultManager
 
Does 'DefaultManager' reference the session instance?
 
Murray 



Replies:
Posted By: davidklitzke
Date Posted: 19-Aug-2010 at 10:59am
From Reference Help:
 
The PersistenceManager constructor example you show uses this signature:

Visual Basic (Declaration)  
Public Function New( _
   ByVal pShouldConnect As Boolean _
)

This constructor will create a new PersistenceManager and optionally connect to the server if pShouldConnect is true.
 
DefaultManager provides an easy way of referencing your "default" PersistenceManager. If you have not explicitly constructed a PersistenceManager DefaultManager will implicitly call the default constructor upon first use. If you have constructed a PersistenceManager DefaultManager will return your first constructed instance.
You can also set the PersistenceManager to be referenced as your DefaultManager. Once set, the PersistenceManager you've indicated will be returned as the "default".

When using DefaultManager without having first constructed an instance with the connection and data source extension of your choice, you lose the ability to catch and diagnose any connection problems to your PersistenceServer, since Connect is called implicitly



Posted By: kimj
Date Posted: 23-Aug-2010 at 11:54am
In ASP.NET, PersistenceManager.DefaultManager is actually scoped to the application and should therefore not be used.



Print Page | Close Window