Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 13th, 2009, 02:23 PM
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default I don’t think we save any process time if…

hi
Page 257:
“The user's location is not retrieved directly from her profile in the preceding code because that would cause a read for each and every row. Insteaad, the user's country, state, and city are read only once from the profile and saved in local variables.”

a) Profile for current user is retrieved from the DB the first time Profile object is accessed, but from that point onward, you can read it without any DB work. So I don’t see how process time is saved if we save user’s location in local variables?!

thanx
 
Old October 13th, 2009, 06:25 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Quote:
Originally Posted by carewithl View Post
hi
Profile for current user is retrieved from the DB the first time Profile object is accessed,
Where are you getting this information? To my knowledge, the ASP.NET runtime does not cache the Profile data.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
carewithl (October 21st, 2009)
 
Old October 14th, 2009, 01:25 PM
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Lee Dumond View Post
Where are you getting this information? To my knowledge, the ASP.NET runtime does not cache the Profile data.
It’s from book Pro Asp.Net 3.5 iin C# 2008.:
“The first time you access Profile object in your code, Asp.Net retrieves the complete profile data for current user from the DB. From this point onward, you can read the profile information in your code without any further database work(until the next postback)”


Anyways, I didn’t say Asp.Net saves profile data for current user across postbacks, but it does save it during the processing of the current request, while author implies that even during the processing of the current request the profile data for current user is retrieved every time we access Profile property
 
Old October 14th, 2009, 01:39 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Who's book is that?

I still don't think that's correct. As far as I know, profile properties are retrieved one at a time as they are called.

This is actually MORE efficient that retrieving the entire Profile object in most cases.

Maybe that author is misinformed. Or maybe I am, but I don't think so.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}

Last edited by Lee Dumond; October 14th, 2009 at 01:41 PM..
The Following User Says Thank You to Lee Dumond For This Useful Post:
carewithl (October 21st, 2009)
 
Old October 16th, 2009, 02:46 PM
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default

hi

Quote:
Originally Posted by Lee Dumond View Post
Who's book is that?
It’s by Mathew MacDonald.


Quote:
Originally Posted by Lee Dumond View Post
I still don't think that's correct. As far as I know, profile properties are retrieved one at a time as they are called.
You mean that particular profile property for current user is retrieved from DB each time it is called, OR just once ( and then it is saved for the duration of current request )?

But even if individual profile property for current user are retrieved the first time it is called ( and then it's saved for the duration of the current request ), then author is still wrong, since calling user’s location directly from profile for each and every row wouldn’t have cause “read ( from DB ) for each and every row” and thus we don’t save any process time if we save user’s location in local variables


cheers mate
 
Old October 16th, 2009, 03:05 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

No, what I am saying is that the data is retrieved from the DB each time a property is accessed. There is no mechanism that I'm aware of that saves it as part of the current request. This means that if you are accessing the data repeatedly (as part of a loop for example), a fetch to the DB takes place for each pass.

This is because the ProfileCommon class fetches property values by calling the GetPropertyValue method, and then casting to the type of the property. The GetPropertyValue method invokes the aspnet_Profile_GetProperties stored procedure in the database.

Also, the ProfileCommon class does not cache the values as they are retrieved.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
The Following User Says Thank You to Lee Dumond For This Useful Post:
carewithl (October 21st, 2009)
 
Old October 21st, 2009, 02:57 PM
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default

I apologize for not replying sooner, but my PC was in repair

Anyways, thanx for helping me out

cheers





Similar Threads
Thread Thread Starter Forum Replies Last Post
Why don’t concrete DAL provider classes derive directly from…? carewithl BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 9 June 22nd, 2009 04:20 PM
Maximum job process time out lathika ASP.NET 2.0 Basics 0 July 11th, 2007 02:26 PM
Problem with CPU time in killing process Samatha General .NET 0 December 14th, 2006 06:37 AM
process every time anoop.goyal Classic ASP Basics 0 May 25th, 2006 01:18 AM
Builiding a time triggered process zicaden Pro PHP 4 September 10th, 2003 04:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.