Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
|
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 July 21st, 2009, 04:57 PM
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default I don't think Article.Body really uses lazy load pattern?!Is this just a typo?

Hello,

Sorry for having two active topics, but the following is driving me nuts:

Author said Article.Body property uses lazy load pattern, where Body field is retrieved only when Body property is accessed for the first time. I understand the concept of lazy load pattern, but for this pattern to work, certain stored procedures (which according to author (page 222) don’t retrieve Body field) shouldn’t retrieve Body field, but they do.

Is this just a typo and thus we can correct it by simply changing SELECT query ( in a stored procedure) to not retrieve Body field, or would other changes also be necessary for lazy load pattern to work with Body property?

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

You are correct in noting that the lazy-load implementation is flawed.

This is because while the implementation does prevent the body of an article from being loaded into article lists, it does not prevent the body from being retrieved from the database, loaded into the reader, and carried across the wire, which is where the real performance bottleneck lies.

To correct this, you could simply prevent the body from being retrieved in any sproc that returns multiple articles. This might involve changing the application code in some places as well.
__________________
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 (August 13th, 2009)
 
Old August 10th, 2009, 05:36 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
You are correct in noting that the lazy-load implementation is flawed.

This is because while the implementation does prevent the body of an article from being loaded into article lists, it does not prevent the body from being retrieved from the database, loaded into the reader, and carried across the wire, which is where the real performance bottleneck lies.

To correct this, you could simply prevent the body from being retrieved in any sproc that returns multiple articles. This might involve changing the application code in some places as well.
Uhm, are you sure about also needing to change some of application code? I thought preventing procedures from retrieving Body would suffice?


thanx
 
Old August 10th, 2009, 05:45 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
Uhm, are you sure about also needing to change some of application code?
Absolutely not sure.

I said you "might" have to, but I haven't really traced through the code closely enough to know. I'd say the best way to be sure is to try it.
__________________
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 (August 13th, 2009)
 
Old August 13th, 2009, 02:15 PM
Authorized User
 
Join Date: Jun 2009
Posts: 32
Thanks: 17
Thanked 0 Times in 0 Posts
Default

thanx for helping me out

cheers
 
Old August 18th, 2009, 06:16 PM
Authorized User
 
Join Date: Aug 2009
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

My thought is that you would have to change the following stored procedures:
tbh_Articles_GetArticles, tbh_Articles_GetArticlesByCategory, tbh_Articles_GetPublishedArticles, tbh_Articles_GetPublishedArticlesByCategory.

At the same time there would be no purpose in overloading the GetArticleCollectionFromReader method in the ArticlesProvider class and call the GetArticleFromReader method using false as the second parameter.

However, even though it is true that the implementation does not really avoid retrieving the bodies from the database, it allows for article lists to have the body. I assume this could be useful if you want to implement a news section where you would need to edit several articles at the same time. Of course you could create specific stored procedures for those cases, and use the ones without the bodies for article listing purposes.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Article: Using Dojo to React to Page Load and Unload jminatel BOOK: Concise Guide to Dojo ISBN: 978-0-470-45202-8 0 January 31st, 2009 02:57 PM
Use of property using the Lazy Load Pattern ? kalel_4444 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 September 24th, 2008 06:56 AM
Lazy Load... Cool but... pbernardo01 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 7 December 28th, 2007 02:00 AM
Error in BLL.Article.Article.cs drohm BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 August 14th, 2006 09:56 AM
DirectoryInfo.GetFiles(pattern): search pattern fo arif_1947 VS.NET 2002/2003 1 October 19th, 2004 11:59 PM





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