New Posts New Posts RSS Feed: ASP.NET Session "Persistence Manager"
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

ASP.NET Session "Persistence Manager"

 Post Reply Post Reply
Author
Murray View Drop Down
Newbie
Newbie


Joined: 28-Feb-2008
Location: Australia
Posts: 4
Post Options Post Options   Quote Murray Quote  Post ReplyReply Direct Link To This Post Topic: ASP.NET Session "Persistence Manager"
    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 
Back to Top
davidklitzke View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 14-Jun-2007
Posts: 715
Post Options Post Options   Quote davidklitzke Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 23-Aug-2010 at 11:54am
In ASP.NET, PersistenceManager.DefaultManager is actually scoped to the application and should therefore not be used.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down