New topic: 

When to use app properties vs session properties

<http://forums.realsoftware.com/viewtopic.php?t=47568>

         Page 1 of 1
   [ 3 posts ]                 Previous topic | Next topic          Author  
Message        dgdavidge          Post subject: When to use app properties vs 
session propertiesPosted: Thu Apr 11, 2013 6:48 pm                         
Joined: Fri Jun 02, 2006 1:43 pm
Posts: 191
Location: Santa Ynez, CA                I have noticed that any time I have to 
access a session property, it takes a long time compared to accessing any other 
property. There is also a problem stepping through a session object with the 
debugger. It won't step through anything that starts with "Session." I have to 
set a break point below it and Resume through the "Session." 

If I understand how all this works correctly, there is a separate instance of 
the entire app for each session. Why then would I want to use "Session." 
properties (or methods) instead of "App." properties? All the documentation I 
have read says to make your database a property of the session. Is there 
something special about a database that requires it to be a session object 
while other properties can be app objects? Or should I not use app properties?

I have tried assigning properties to the app and have not noticed any problems, 
but I am reluctant to use them in a published app for fear of the database 
admonition.   
                             Top                simulanics          Post 
subject: Re: When to use app properties vs session propertiesPosted: Thu Apr 
11, 2013 6:59 pm                                 
Joined: Sun Aug 12, 2007 10:10 am
Posts: 1041
Location: Boiling Springs, SC                If you set a property in the App 
class, it is accessible to every user that connects to your app and will be the 
same for every user connecting...if you set the property in the session...each 
user's setting will be individualized....

example...location to the app database would be the same for every user (app 
class)

username, password, identifying information is individualized (session class)

remember that debuggging will naturally be slower than the compiled build 
release...      
_________________
Matthew A. Combatti
Real Studio 2012 r1.2
Visit Real Studio Developer's Spot!
Systems I Use:
Windows XP/Windows Vista/Windows Server 2008 r2/Windows 7/Windows 8
Mac OSX 10.5/Mac OSX 10.6/Mac OSX Server/Ubuntu/Debian/Suse/Red Hat/
Windows Server 2011/CentOS 5.4 /ReactOS/SimOS
~All REAL Compatible~  
                             Top                timhare          Post subject: 
Re: When to use app properties vs session propertiesPosted: Thu Apr 11, 2013 
7:21 pm                         
Joined: Fri Jan 06, 2006 3:21 pm
Posts: 12224
Location: Portland, OR  USA                dgdavidge wrote:If I understand how 
all this works correctly, there is a separate instance of the entire app for 
each session. 
You misunderstand.  There is a single instance of the app running on the 
server.  Each user connects to that single instance.  There is one app object.  
A new Session object is created for each connection.  

The properties in app are global to all sessions.  You shouldn't put a database 
connection in app because all your queries would run through that one pipe.  
And if any session closes the db, it is closed for everyone.  Therefore, put 
the database object in the session.

One other thing to be aware of is that "Session" is a function, not a property. 
 It has to do a bunch of work behind the scenes.  So use local, temporary 
variables instead of access session.xxx over and over.

dim db as database = session.db
db.xxx
db.yyy
etc   
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 3 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to